A developer is configuring an AWS CodePipeline with an AWS CodeDeploy stage to deploy a containerized application to an Amazon ECS service using a blue/green deployment strategy. The deployment fails. The developer observes two issues:
1. The CodeDeploy deployment fails immediately with an error indicating an invalid AppSpec file configuration, where the developer specified `BeforeInstall` and `AfterInstall` lifecycle hooks.
2. The ECS tasks fail to start because they cannot download the application configuration file from an Amazon S3 bucket, despite the developer having attached the S3 read permissions to the ECS Task Execution Role.
Which two actions should the developer take to resolve these deployment issues? (Select TWO.)
- Replace the `BeforeInstall` and `AfterInstall` lifecycle hooks in the AppSpec file with `BeforeAllowTraffic` and `AfterAllowTraffic` hooks.Cevap
- Move the S3 read permission policy from the ECS Task Execution Role to the ECS Task Role.Cevap
- CChange the AppSpec lifecycle hooks to `ApplicationStart` and `ApplicationStop` to control container startup.
- DAttach the S3 read permission policy to the CodeDeploy service role since CodeDeploy manages the container tasks during deployment.
- EModify the ECS Task Role trust policy to trust the Amazon S3 service instead of the Amazon ECS tasks service.
Cevap
Replace the `BeforeInstall` and `AfterInstall` hooks with `BeforeAllowTraffic` and `AfterAllowTraffic`, and move the S3 read permission policy from the ECS Task Execution Role to the ECS Task Role.
The correct options modify the AppSpec hooks to use ECS-supported lifecycle hooks (`BeforeAllowTraffic` and `AfterAllowTraffic`) and assign S3 read permissions to the ECS Task Role, which is the role that containerized applications use to access AWS resources.
Adım Adım Çözüm
Anahtar Kavram
Understanding ECS Task Roles vs Task Execution Roles, and ECS-specific CodeDeploy AppSpec lifecycle hooks.