Skip to content

Commit 1b84e52

Browse files
committed
Added checks to ensure the user has provided the SNStopic and accountId.
1 parent 8f4ae48 commit 1b84e52

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Monitoring/auto-add-cw-alarms/auto_add_cw_alarms.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
################################################################################
2828
#
2929
# Define which SNS topic you want "volume full" message to be sent to.
30-
SNStopic='keith-volume-full'
30+
SNStopic=''
3131
#
3232
# Provide the account id the SNS topic resides under:
3333
# MUST be a string.
34-
accountId='759995470648'
34+
accountId=''
3535
#
3636
# Set the customer ID associated with the AWS account. This is used to
3737
# as part of the alarm name prefix so a customer ID can be associated
@@ -234,6 +234,14 @@ def lambda_handler(event, context):
234234
if customerId != '':
235235
customerId = f", CustomerID: {customerId}"
236236

237+
if len(SNStopic) == 0:
238+
raise Exception("You must specify a SNS topic to send the alarm messages to.")
239+
return
240+
241+
if len(accountId) == 0:
242+
raise Exception("You must specify an accountId to run this program.")
243+
return
244+
237245
if len(regions) == 0:
238246
ec2Client = boto3.client('ec2')
239247
ec2Regions = ec2Client.describe_regions()['Regions']

0 commit comments

Comments
 (0)