Permissions required for Lambda functions in Amazon ECS blue/green deployments - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Permissions required for Lambda functions in Amazon ECS blue/green deployments

When you use Lambda functions as deployment lifecycle hooks in Amazon ECS blue/green deployments, you need to create an IAM role with specific permissions. This role allows Amazon ECS to invoke your Lambda functions at various stages of the deployment lifecycle.

The following additional permissions are required:

  • lambda:InvokeFunction – Allows Amazon ECS to invoke Lambda functions configured as lifecycle hooks during the deployment process.

The following policy contains the required permissions for Lambda lifecycle hooks:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lambda:InvokeFunction" ], "Resource": "arn:aws:lambda:*:*:function:ECS-*" }, { "Effect": "Allow", "Action": ["iam:PassRole","lambda:InvokeFunction"], "Resource": "arn:aws:lambda:*:*:function:ECS-*" } ] }

For the trust policy, you need to allow the service to assume this role:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "ecs.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }