AWS 12, 13, 14 Flashcards
What is the Origin Access Identity in CloudFront?
It is a special CloudFront user that has access to origins for CloudFront;
We configure the S3 bucket permissions so that CloudFront can use the OAI to access the files in your bucket;
Generally we would want to restrict access to our S3 origin so that only the OAI has access.
EC2 Instances MUST be public when using them with CloudFront, true or false?
True. Unless we introduce an ALB. Then the ALB can be public and the EC2 instances can be private.
What is the major difference between CloudFront and S3 CRR?
S3 Cross Region Replication is read only and great for dynamic content that needs to be available at low-latency in few regions;
CloudFront files are cached for a TTL (maybe a day) and is great for static content that must be available everywhere;
Also note that in S3 CRR, files are copied to a different bucket, so users would still need to know that URL (or possibly use Route53?)
What is a common strategy for maximizing cache hits in CloudFront?
We can separate Dynamic and Static content distributions
What is the Viewer Protocol Policy in CloudFront?
It sits between the client and the edge location. It redirects HTTP to HTTPS or requires use of HTTPS only. Suggested is a redirect.
What is the Origin Protocol Policy in CloudFront for HTTP or S3?
Sits between the Edge Location and Origin. Either set HTTPS only or Match Viewer, which keeps the request of the client.
S3 Bucket “websites” support HTTPS, true or false?
False. If you want to support HTTPS access you can use CloudFront to serve a static website hosted on Amazon S3.
Setting a CloudFront Origin Access Identity sets up a bucket policy for S3 bucket, however, we can keep the Block Public Access settings up for the bucket. How?
CloudFront hits the origin (S3 Bucket) from Amazons private network.
What is the difference between a signed cookie and signed URL in CloudFront?
Signed URL gives access to individual files and signed cookies give access to multiple files
How long should a signed URL be valid for?
For shared content, make it short. For private content you can make it much longer.
CloudFront is deploying in front of an HTTP origin. After updating your HTTP app, the users still see the old website. What should you do?
Invalidate the distribution
What are the three container management platforms?
ECS, Fargate, EKS
What is a task definition in ECS? What is some information it contains?
Metadata in JSON form to tell ECS how to run a Docker Container; Image Name; Port binding for Container and Host; Memory and CPU Required; Env variables; Launch type to use; Logging configuration;
We created a container that cannot communicate to any other AWS services. What is a probable reason?
We did not add a task role
What is portMapping in ECS?
It will take the network calls that go through the Host network port number (e.g. 8080) and route them to the Container network port number (e.g. 80)
For a specific service in ECS, we updated our desired tasks from 1 to 2. Yet no new tasks were launched, as Desired tasks was 2 but Running tasks was 1. How do we fix this?
We need to scale the instances. We can do this by going to the Auto Scaling Group behind our instances and update the desired capacity to 2. This is under the assumption that we are only allowing one task to one instance
What is a Task in ECS?
This is a running container with the settings defined in the Task Definition. It can be thought of as an “instance” of a task definition.
We get the error ‘[AWS Service] was unable to place a task because no container instance met all of its requirements.”, and that its already using a port required by the task. How can we fix this?
We can add container instances to a cluster or reduce the number of desired tasks. However, it is preferable to use an Application Load Balancer with dynamic port mapping
What is Dynamic Port Mapping?
Dynamic Port Mapping allows you to run multiple tasks over the same host using multiple random host ports
What is a service in ECS?
A service enables you to run and maintain a specified number of instances of a task definition simultaneously in an Amazon ECS cluster
We have updated a task definition in ECS. However, we don’t see the changes when we interact with the instances. What is a possible reason?
We need to make sure that we update the service with the new task definition version as well.
You have created a load balancer for your ECS service to use. What must you do with the security group attached to the cluster?
We must make sure that we can allow all traffic from the ALB security group that we created for Dynamic Port Mapping.
What is the Amazon ECS Container Instance IAM Role?
It allows the Container instances that run the ECS container agent to make calls to ECS on your behalf. The IAM role and policy allow the service to know the agent belongs to you.
What is ECR?
It is a private Docker image repository within your AWS account
If you have permission errors to ECR, what could be the reason?
You need IAM permissions to access ECR
**What is the AWS CLI v1 login command for ECR?
$(aws ecr get-login –no-include-email –region eu-west-1)
**What is the AWS CLI v2 login command for ECR?
aws ecr get-login-password –region eu-west-1 | docker login –username AWS –password-stdin 1234567890-dkr.ecr.eu-west-1.amazonaws.com
What are the four commands to push a docker image to ECR?
Login to ECR and Docker;
Build the Docker image;
Tag the image (get it ready for a push specifying the source);
Push the image up