ECS Flashcards
What is the role of dynamic port mapping with respect to ECS? Which ELB type supports this?
Dynamic port mapping is used to load balance ECS tasks on an EC2 instance and is supported by an ALB
What is a task role with respect to ECS?
Optional IAM role that tasks can use to make API requests to authorized AWS services. Create an Amazon Elastic Container Service Task Role in the
What is the difference between a REPLICA and a DAEMON service type with respect to setting up an ECS service?
A replica will attempt to run the desired specified amount of tasks accross the ECS cluster. A Daemon service runs one copy of the task on each of the EC2 instances in the cluster and is useful for monitoring.
What is a Blue/Green deployment and what AWS technology can be used to execute a blue/green deployment against ECS?
A blue/green deployment consists of having individual deployments of both your existing code, and new code. A proportion of traffic can be routed to the new code to determine stability. A blue/green deployment allows fast roll backs. AWS CodeDeploy is used for Blue/Green deployments on ECS.
We need to create a load balanced ECS cluster with multiple tasks per container. Would you use a classic or application load balancer?
Application. A classic load balancer allows only one task per container instance
We have created an ECS Cluster intended to serve HTTP traffic. When defining the task definition, we have set up a port mapping to take traffic inbound on on the Host EC2 instances port 8080 and dynamic port mapping for the containers. The cluster starts without any issue, but when we attempt to hit the sites index.html page using port 8080, we get a time out. Why?
The security group that is created for the cHost EC2 instances setup when defining the cluster does not allow traffic inbound on port 8080.
We have created an ECS Cluster intended to serve HTTP traffic. When defining the task definition, we have set up a port mapping to take traffic inbound on on the host EC2 instances port 8080 and map it to the Docker container port 80. In our service definition for the tasks we specify that we want to run 3 copies of the task definition on the same ECS Container. What are we likely to see in the ECS Event logs for that service and how many tasks will we see running?
We will see 1 task running and message stating that we were unable to place a task because no container instance met all of its requirements due a required port (host port 8080) already in use.
We have a task set up in ECS which has defined a container. This container needs access to images stored on S3, but can’t seem to access the bucket. Why?
A task role needs to be set up defining allowing access to the specified bucket
What would you use ECR for?
ECR is the AWS docker container repository. It is private to your account and is used to store docker images within AWS.
You are attempting to do a pull request for a docker image against ECR, but get a permission denied error. Why?
Access to ECR is controlled by IAM. If you are getting a permission denied for push or pull requests it is because your IAM policy is not set up correctly and permissive enough.
What is the purpose of this command and what is the meaning of the pipe? Which CLI version is this for?
aws ecr get-login-password –region us-east-1 | docker login –username AWS –password-stdin 260783585248.dkr.ecr.us-east-1.amazonaws.com
this command performs a login against an ECR repository. The command is split into two by the pipe, with the inital aws component generating a password for the ECR repo, which is then piped through to the docker command which performs the login. This is for CLI version 2.
What is the purpose of this command?
docker push 260783585248.dkr.ecr.us-east-1.amazonaws.com/udemy-ecr-training:latest
this pushes a docker image to an ECR repository
We currently have a task definition - httpd:1. What version is this definition?
Version 1
I have a task definition set up to service http requests - the definition is called httpd:1. As part the setup, the task defition has a container (called httpd) which uses the public httpd:2.4 docker image from apache. We need to update this image to one that we have placed in ECR which contains some custom setup. Can we change the task definition as it stands to include this new image?
No, we will need to create a new version of the task definition and then make changes to the container settings in the new version.
When setting up an ECS infrastructure, where would you define the task role?
In the task definition
In terms of IAM and ECS, there are two key IAM components which define how and with what the ECS agent can communicate with, and how and what the ECS task can communicate with. What are they? (Hint think specifically of what ECS runs on, not Fargate)
EC2 Instance profile is used by the ECS agent and allows it to make calls to the ECS API, Cloudwatch and ECR
Task Roles allow a task to be assigned specific roles per task and different tasks can have different roles assigned to them - for instance one task can have getObject permissions on S3, another can have permissions to the EC2 API.
What 3 things does an EC2 ECS instance profile allow the ECS Agent to interact with ?
- Cloudwatch Logs (For shipping container logs)
- ECR (for pulling images)
- ECS API (for making calls to the ECS API)