EC2 201 Flashcards
What is a placement group?
When you create an instance on EC2, AWS will automatically, intelligently place it in such a way that you’re less likely to have multiple instances fail (e.g. avoiding using the same hardware for two instances).
However, if you want to influence AWS’s placement strategy further, you can create a PLACEMENT GROUP of several instances, and AWS will try to place those instances according to the type of placement group you choose.
What are the three types of placement groups? Summarize each one.
Cluster: Packs instances close together inside an AZ. This optimizes for low-latency communication between instances, at the cost of increased risk of losing multiple instances in an outage. Ideal for clustered high performance computing.
Partition: Your instances are divided into groups called “partitions”. Each partition is hosted on a different hardware rack. Less risk of simultaneous failure (compared to Cluster), while still highly performant. A PPG can optionally have partitions in multiple AZs in the same region.
Spread: No instance shares the same rack. Even less risk of simultaneous failure, at the cost of more performance. Like PPG, can optionally span multiple AZ in the same region. A good option if you have a small number of critical instances that should be kept separate from each other.
I want to spin up multiple EC2 instances for a Kafka (partitionaware stream-processing platform) cluster. How can I make sure that my instances are lower latency, without risking losing the whole cluster if there’s a hardware failure?
Create a “partition” placement group for the instances. Any partition-aware software (hadoop, cassandra, kafka) is a good fit for a PPG.
I work for Genentech, analyzing biomarker data generated from clinical trials. It’s incredibly computationally complex work done that demands low latency between powerful machines on proprietary software. What type of EC2 instance should I use, and how can I keep latency as low as possible?
You’ll want to use a Compute Optimized EC2 instance, and you can use a “cluster” placement group to optimize for performance (over reliability).
What is EC2 Hibernate?
Saves in-memory state to “hibernate” an EC2 instance for fast booting (no restarting the OS).
Caveats:
The root EBS volume must be encrypted.
RAM must be lesss than 150 GB.
Can’t be hibernated for more than 60 days.
Only for on-demand and reserved instances, and not all instance types support it.
Under the hood, it’s actually writing RAM state to a file in the root EBS volume.
What is EC2 Nitro?
New virtualization technology for the next generation of EC2 instances. Better performance, better networking options, higher speed EBS, better underlying security. Only later instance generation can support it.
How can I get higher IOPS for my EC2 instance?
Use EC2 Nitro.
What is my IOPS limit with Nitro vs without?
64k EBS IOPS with it, 32k without.
What is a vCPU?
A virtual CPU. Each vCPU represents a thread.
For example, when you launch an m5.xlarge, you get 4 CPU, 2 threads per CPU, so 8 vCPU total.
What is a capacity reservation?
By creating Capacity Reservations, you ensure that you always have access to EC2 capacity when you need it, for as long as you need it. You can create Capacity Reservations at any time, without entering into a one-year or three-year term commitment, and the capacity is available immediately.
Billing (priced at the same as the EC2 instance cost) starts as soon as the capacity is provisioned and the Capacity Reservation enters the active state. When you no longer need it, cancel the Capacity Reservation to stop incurring charges
How can I ensure that an AWS instance is available when I need it?
Reserved instances are one option, if you expect to use something for 1-3 years.
Alternatively, you can make a capacity reservation. This can be cancelled or made at any time, but it costs the same as running the ec2 instance type (though if you run said instance while you have an open reservation, you only pay once).
Can I use AMIs across regions?
No, you need to copy it to another region if you want to use it there.
If I copy an AMI, will it have the same ID?
No, a new ID is created for that copy.
How can an EC2 instance programmatically get policy name, AMI ID, security groups, etc.
Instance metadata: a static HTTP endpoint it can send requests to, which will return data for that specific instance.