EC2 101 Flashcards
What is EC2?
Elastic Compute Cloud. A service for renting virtual machines.
What are two ways you can pre-configure an EC2 instance?
1) Create an AMI from an existing EC2 instance, and use that as the base for launching new instances.
2) Add an EC2 user data script.
What is an AMI?
Amazon Machine Image
What are the advantages of User Data vs AMI?
An AMI is way faster than doing user data, and will always give you a consistent starting image to launch from.
The user data is just a script that runs every time when the image is launching. It can take several minutes to run, is more error-prone, but could be used to do dynamic configuration of an instance (especially in conjunction with instance metadata). Personally, I’d avoid using it in favor of docker or something.
User data vs instance metadata?
User data is a script that you run when launching an instance.
Instance metadata is an HTTP endpoint an instance can query as a means of reflection (to know what its configuration info is).
What are the four instance types?
- General Purpose (t, m, a1, mac)
- Compute Optimized (c)
- Memory Optimized (r, x)
- Storage Optimized (I, d, H)
What’s notable about the t-series instances?
The t-series is your most common, low-cost, general purpose instance. Most machines in this family are burstable, meaning that they have consumable “burst credits” that are used during short periods of higher-than-normal use.
What permissions does the user data script have?
It’s run as the root user
Use cases for General Purpose EC2 instance
Diversity of workloads like web servers or code repositories. The burstable nature of t-series are nice for web servers that have variable traffic.
Use cases for Compute Optimized EC2 instance
Back processing workloads, media transcoding, machine learning, HPC, high permance web servers, dedicated game servers
Use cases for Memory Optimized EC2 instance
High performance, relational/non-relational databases; Distributed web scale cache stores; Applications performing real-time processing of big unstructured data
Use cases for Storage Optimized EC2 instance
When you need high, sequential read/write access to large data sets on local storage. Relational/NoQL databases, Data warehousing, distributed file systems
What is a security group?
Acts as a “firewall” on EC2 instances. It defines what goes in and what goes out.
You try to ssh into an EC2 instance and get a timeout. What should you check first?
Check your security groups for the instance. You probably need to open port 22 for SSH access. As a best practice, it’s good to have a sec group that’s just for SSH access.
What happens if I don’t have a security group for an EC2 instance?
All outbound traffic is allowed, all inbound traffic is blocked.