Reputation: 583
i have lambda function which creates new launch configuration by passing auto scale group name. it works and i have created code deploy and attached a trigger to execute Lambda function when deployment success. but i get this error
'targetASG': KeyError Traceback (most recent call last): File "/var/task/lambda_function.py", line 12, in lambda_handler ASG = asObj.describe_auto_scaling_groups(AutoScalingGroupNames=[event['targetASG']]) KeyError: 'targetASG'
targetASG is my parameter but i don't see anywhere that i can define that (triggers,SNS). how can i pass this parameter from code deploy?
Upvotes: 0
Views: 770
Reputation: 191
Unfortunately, today CodeDeploy doesn't support a way for customers to pass the additional metadata/parameters when invoking the hook functions.
As a workaround, you will have to implement the logic in the hook function to pull up the target ASG name in this case.
Upvotes: 0
Reputation: 8140
You can define a Lambda endpoint for your SNS and the SNS page.
Sign in to the AWS Management Console and open the Amazon SNS console at https://console.aws.amazon.com/sns/v2/home.
In the left Navigation pane, click Topics, and then click the topic to which you want to subscribe a Lambda endpoint.
Click Actions and then click Subscribe to topic.
In the Protocol drop-down box, select AWS Lambda.
In the Endpoint drop-down box, select the ARN for the Lambda function.
In the Version or Alias drop-down box, select an available version or alias to use. You can also choose $LATEST to specify the latest version of the Lambda function. If you do not want to specify a version or alias, you can also choose default, which is functionally the same as $LATEST. For more information, see AWS Lambda Function Versioning and Aliases.
Click Create subscription.
Upvotes: -1