A developer is using AWS CodeDeploy to deploy a Node.js web application to a fleet of Amazon EC2 instances. During the initial deployment run, the deployment fails.
The developer inspects the deployment console and identifies two root causes:
1. The CodeDeploy service is unable to interact with the EC2 instances to initiate the deployment.
2. A bash script specified in the `appspec.yml` file fails with an access denied error when attempting to retrieve database credentials from AWS Systems Manager Parameter Store.
The application's `appspec.yml` file is configured as follows:
yaml
version: 0.0
os: linux
files:
- source: /index.js
destination: /var/www/html/
hooks:
BeforeInstall:
- location: scripts/decrypt_creds.sh
timeout: 300
runas: dbadmin
Which two configurations must the developer implement to resolve these issues? (Select TWO.)
- Configure the trust policy of the CodeDeploy service role to allow the codedeploy.amazonaws.com service principal to perform the sts:AssumeRole action.Cevap
- Attach an IAM policy that grants ssm:GetParameters and ssm:GetParameter permissions to the IAM role associated with the EC2 instance profile.Cevap
- CAttach an IAM policy that grants ssm:GetParameters and ssm:GetParameter permissions directly to the CodeDeploy service role.
- DChange the hook in the appspec.yml file from BeforeInstall to BeforeAllowTraffic to execute the validation script before traffic shifting begins.
- EMigrate the credentials to AWS Secrets Manager, and grant the EC2 instance profile role permissions to retrieve them using the ssm:GetParameters policy action.