When starting a ECS Task, it takes around 12-30sec to get from creation of the task to start of the task. Docker Image in the task is from private ECR repository, and has 169.64MB. I'm using m5.large instance for EC2. Task Details
Is there anything we can do to shorten this time, between creation and starting the task? For example more powerful EC2 instance? Or some settings, optimization that I'm missing?
CodePudding user response:
You'll likely be able to see improvements with bigger instances, however I suspect the time-consuming bit is the retrieval of the docker image from ECR; you can optimize this by:
- Using a vpc endpoint for private connectivity to the ECR service. This will be faster than going over the public internet.
- Enable enhanced networking with ENA for the EC2 instance
Useful links:
(1): https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
(2): https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html