A maritime freight analytics platform, VesselWave, is modernizing its containerized route-optimization application by migrating it from an on-premises Docker Swarm cluster to Amazon Elastic Container Service (Amazon ECS) on AWS Fargate. The application tasks will run in private subnets and must not have any direct access to or from the public internet. The container images are stored in a private Amazon Elastic Container Registry (Amazon ECR) repository, and the application must write logs to Amazon CloudWatch. Which TWO configurations must the Solutions Architect implement to allow the Fargate tasks to securely pull images and write logs while adhering to these constraints?
- Create interface VPC endpoints for com.amazonaws.region.ecr.api and com.amazonaws.region.ecr.dkr in the VPC, and a gateway VPC endpoint for Amazon S3 associated with the private subnets' route tables.Cevap
- Configure the Amazon ECS task definition to use the awsvpc network mode, and assign an ECS task execution IAM role that grants permissions to pull images from Amazon ECR and write logs to Amazon CloudWatch.Cevap
- CConfigure the Amazon ECS task definition to use the bridge network mode, and deploy an Application Load Balancer to route traffic to the container hosts.
- DDeploy a single NAT Gateway in a public subnet, and configure the private subnets' route tables to route all outbound 0.0.0.0/0 traffic to the NAT Gateway.
- ECreate a custom Route 53 Private Hosted Zone for ECR endpoints and manually associate it with the VPC while disabling DNS hostnames and DNS resolution features.
Cevap
The correct configurations are to create interface VPC endpoints for ECR and a gateway VPC endpoint for S3, and to configure the task definition with the awsvpc network mode alongside an appropriate ECS task execution IAM role.
To run Amazon ECS tasks on AWS Fargate within private subnets without public internet routing, the tasks must use the awsvpc network mode. The ECS agent needs to pull images from Amazon ECR and send logs to CloudWatch. Because there is no internet route, AWS PrivateLink interface VPC endpoints for ECR (both ecr.api and ecr.dkr) must be created in the VPC. Additionally, because ECR stores its image layers in Amazon S3, a gateway VPC endpoint for S3 is required to allow tasks to download the layers. Finally, the ECS task execution IAM role must have the necessary policy permissions to authenticate with ECR, pull the image, and write to CloudWatch log streams.
Adım Adım Çözüm
Anahtar Kavram
Configuring secure private network connectivity and execution roles for Amazon ECS tasks running on AWS Fargate in isolated subnets.
Tahmini Süre:2m 0s