From c722349db3fb987e919c8600e7a42b57582b5750 Mon Sep 17 00:00:00 2001 From: "shibata.r" Date: Thu, 13 Oct 2022 16:50:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=E5=A4=89=E6=95=B0=E5=90=8D=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lambda/stop-rds/stop-rds.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lambda/stop-rds/stop-rds.py b/lambda/stop-rds/stop-rds.py index 9230349d..0a3a0783 100644 --- a/lambda/stop-rds/stop-rds.py +++ b/lambda/stop-rds/stop-rds.py @@ -3,8 +3,8 @@ import os #環境変数 client = boto3.client('rds') -TAGKEY = os.environ['TAGKEY'] -TAGVALUE = os.environ['TAGVALUE'] +AUTO_STOP_TAG_TAGKEY = os.environ['TAGKEY'] +AUTO_STOP_ENABLE = os.environ['TAGVALUE'] def lambda_handler(event, context): #クラスターを停止 @@ -13,7 +13,7 @@ def lambda_handler(event, context): if cluster['Status'] == "available": tags = client.list_tags_for_resource(ResourceName=cluster['DBClusterArn']) for tag in tags['TagList']: - if tag['Key'] == TAGKEY and tag['Value'] == TAGVALUE: + if tag['Key'] == AUTO_STOP_TAG_TAGKEY and tag['Value'] == AUTO_STOP_ENABLE: client.stop_db_cluster(DBClusterIdentifier=cluster['DBClusterIdentifier']) #インスタンスを停止 @@ -22,6 +22,6 @@ def lambda_handler(event, context): if instance['DBInstanceStatus'] == "available": tags = client.list_tags_for_resource(ResourceName=instance['DBInstanceArn']) for tag in tags['TagList']: - if tag['Key'] == TAGKEY and tag['Value'] == TAGVALUE: + if tag['Key'] == AUTO_STOP_TAG_TAGKEY and tag['Value'] == AUTO_STOP_ENABLE: client.stop_db_instance(DBInstanceIdentifier=instance['DBInstanceIdentifier']) \ No newline at end of file