An engineering team is setting up a CI/CD pipeline using AWS CodeDeploy to deploy a Node.js web application to a fleet of Amazon EC2 instances. The deployment configuration must ensure that the application is fully running and able to handle traffic before the deployment is marked as successful. Additionally, CodeDeploy requires authorization to interact with EC2 auto-scaling groups and load balancers during the deployment process.
Which of the following configurations must be implemented to meet these requirements? (Select TWO.)
- Configure an IAM service role for AWS CodeDeploy with a trust policy that allows the codedeploy.amazonaws.com service principal to assume the role.Answer
- Use the ValidateService lifecycle hook in the appspec.yml file to execute a script that checks the application's local health endpoint.Answer
- CUse the BeforeAllowTraffic lifecycle hook in the appspec.yml file to run the integration test scripts before shifting traffic.
- DModify the trust policy of the EC2 instance profile's IAM role to trust the codedeploy.amazonaws.com service principal.
- EStore the application's configuration parameters in AWS Systems Manager Parameter Store and grant the CodeDeploy service role secretsmanager:GetSecretValue permissions.
Answer
Configure an IAM service role for AWS CodeDeploy with a trust policy that allows the codedeploy.amazonaws.com service principal to assume the role, and use the ValidateService lifecycle hook in the appspec.yml file to execute a script that checks the application's local health endpoint.
To allow AWS CodeDeploy to perform deployments on EC2/On-Premises instances, it needs a service role that trusts the 'codedeploy.amazonaws.com' service principal. This role grants the service permission to interact with other AWS services like EC2, Auto Scaling, and Elastic Load Balancing. To verify the service health post-deployment, the 'ValidateService' lifecycle hook in the EC2 AppSpec file must be used to run validation scripts before CodeDeploy marks the deployment as successful.
Step-by-Step Solution
Key Concept
Configuring AWS CodeDeploy service roles and understanding EC2-specific AppSpec lifecycle hooks.
Estimated Time:2m 0s