Amazon EC2 for SysOps Flashcards
(47 cards)
EC2 Changing Instance Type
- This only works for EBS backed instances
- Stop the instance
- Instance Settings => Change Instance Type
- Start Instance
EC2 Enhanced Networking (SR-IOV)
- Higher bandwidth, higher PPS (packet per second), lower latency
- Option 1: Elastic Network Adapter (ENA) up to 100 Gbps
- Option 2: Intel 82599 VF up to 10 Gbps – LEGACY
- Works for newer generation EC2 Instances
Enhanced Networking - Elastic Fabric Adapter (EFA)
- Improved ENA for HPC, only works for Linux
- Great for inter-node communications, tightly coupled workloads
- Leverages Message Passing Interface (MPI) standard
- Bypasses the underlying Linux OS to provide low-latency, reliable transport
Placement Groups
- Sometimes you want control over the EC2 Instance placement strategy
- That strategy can be defined using placement groups
- When you create a placement group, you specify one of the following
strategies for the group: - Cluster—clusters instances into a low-latency group in a single Availability Zone
- Spread—spreads instances across underlying hardware (max 7 instances per group per AZ) – critical applications
- Partition—spreads instances across many different partitions (which rely on different sets of racks) within an AZ. Scales to 100s of EC2 instances per group
(Hadoop, Cassandra, Kafka)
Placement Groups Cluster
Pros: Great network (10 Gbps bandwidth between instances with Enhanced Networking enabled - recommended)
* Cons: If the AZ fails, all instances fails at the same time
* Use case:
* Big Data job that needs to complete fast
* Application that needs extremely low latency and high network throughput
Placement Groups Spread
- Pros:
- Can span across Availability Zones (AZ)
- Reduced risk is simultaneous
failure - EC2 Instances are on different
physical hardware
Cons:
* Limited to 7 instance
Use case:
EC2
* Application that needs to maximize high availability
Hardware 6
* Critical Applications where each instance must be isolated
from failure from each other
Placements Groups Partition
- Up to 7 partitions per AZ
- Can span across multiple AZs in the same region
- Up to 100s of EC2 instances
- The instances in a partition do not share racks with the instances in the EC2 other partitions
- A partition failure can affect many EC2 but won’t affect other partitions EC2
- EC2 instances get access to the partition information as metadata.
- Use cases: HDFS, HBase, Cassandra, Kafka
Shutdown Behavior
- Shutdown Behavior: How should the instance
react when shutdown is done using the OS? - Stop (default)
- Terminate
- This is not applicable when shutting down from AWS console.
- CLI Attribute:
InstanceInitiatedShutdownBehavior
Termination Protection
- Enable termination protection:
To protect against accidental termination in AWS Console or CLI - Exam Tip:
- We have an instance where shutdown behavior = terminate and enable terminate protection is ticked
- We shutdown the instance from the OS, what will happen ?
- The instance will still be terminated!
InstanceLimitExceeded
EC2 Launch Tshooting - InstanceLimitExceeded
- # InstanceLimitExceeded: if you get this error, it means that you have reached your limit of max number of vCPUs per region
- On-Demand instance limits are set on a per-region basis
- Resolution: Either launch the instance in a different region or request AWS to increase your limit of the region
- NOTE: vCPU-based limits only apply to running On-Demand instances and Spot instances
EC2 Launch Troubleshooting - InsufficientInstanceCapacity
- # InsufficientInstanceCapacity : if you get this error, it means AWS does not have that enough On-Demand capacity in the particular AZ where the instance is launched.
- Resolution :
- Wait for few mins before requesting again.
- If requesting more than 1 requests, break down the requests. If you need 5 instances, rather than a single request of 5, request one by one.
- If urgent, submit a request for a different instance type now, which can be
resized later. - Also, can request the EC2 instance in a different AZ
EC2 Launch Troubleshooting - Instance Terminates Immediately
- # Instance Terminates Immediately (goes from pending to terminated)
- You’ve reached your EBS volume limit.
- An EBS snapshot is corrupt.
- The root EBS volume is encrypted and you do not have permissions to access the KMS key for decryption.
- The instance store-backed AMI that you used to launch the instance is missing a required part (an image.part.xx file).
- To find the exact reason, check out the EC2 console of AWS - instances - Description tab, note the reason next to the State transition reason label.
EC2 SSH troubleshooting - Logging in Errors
- Make sure the private key (pem file) on your linux machine has 400 permissions, else you will get “Unprotected private key file” error
- Make sure the username for the OS is given Correctly when logging in via SSH. Else you will get a “Host Key Not Found”, “Permission Denied” , or “Connection Closed by [instance}” port 22 error.
EC2 SSH troubleshooting - Connection timed out
- Possible reasons for “Connection timed out” to EC2 instance via SSH:
- SG is not configured correctly
- NACL is not configured correctly
- Check the route table for the subnet (routes traffic destined outside VPC to IGW)
- Instance doesn’t have a public IPv4
- CPU load of the instance is high
SSH vs. EC2 Instance Connect
EC2 Instances Purchasing Options
- On-Demand Instances – short workload, predictable pricing, pay by second
- Reserved (1 & 3 years)
- Reserved Instances – long workloads
- Convertible Reserved Instances – long workloads with flexible instances
- Savings Plans (1 & 3 years) –commitment to an amount of usage, long workload
- Spot Instances – short workloads, cheap, can lose instances (less reliable)
- Dedicated Hosts – book an entire physical server, control instance placement
- Dedicated Instances – no other customers will share your hardware
- Capacity Reservations – reserve capacity in a specific AZ for any duration
EC2 On Demand
- Pay for what you use:
- Linux or Windows - billing per second, after the first minute
- All other operating systems - billing per hour
- Has the highest cost but no upfront payment
- No long-term commitment
- Recommended for short-term and un-interrupted workloads, where you can’t predict how the application will behave
EC2 Savings Plans
- Get a discount based on long-term usage (up to 72% - same as RIs)
- Commit to a certain type of usage ($10/hour for 1 or 3 years)
- Usage beyond EC2 Savings Plans is billed at the On-Demand price
- Locked to a specific instance family & AWS region (e.g., M5 in us-east-1)
- Flexible across:
- Instance Size (e.g., m5.xlarge, m5.2xlarge)
- OS (e.g., Linux, Windows)
- Tenancy (Host, Dedicated, Default)
EC2 Spot Instances
- Can get a discount of up to 90% compared to On-demand
- Instances that you can “lose” at any point of time if your max price is less than the current spot price
- The MOST cost-efficient instances in AWS
- Useful for workloads that are resilient to failure -
- Batch jobs
- Data analysis
- Image processing
- Any distributed workloads
- Workloads with a flexible start and end time
- Not suitable for critical jobs or databases
EC2 Dedicated Hosts
- A physical server with EC2 instance capacity fully dedicated to your use
- Allows you address compliance requirements and use your existing server-
bound software licenses (per-socket, per-core, pe—VM software licenses) - Purchasing Options:
- On-demand – pay per second for active Dedicated Host
- Reserved - 1 or 3 years (No Upfront, Partial Upfront, All Upfront)
- The most expensive option
- Useful for software that have complicated licensing model (BYOL – Bring Your
Own License) - Or for companies that have strong regulatory or compliance needs
EC2 Dedicated Instances
- Instances run on hardware that’s dedicated to you
- May share hardware with other instances in same account
- No control over instance placement (can move hardware after Stop / Start)
EC2 Capacity Reservations
- Reserve On-Demand instances capacity in a specific AZ for any
duration - You always have access to EC2 capacity when you need it
- No time commitment (create/cancel anytime), no billing discounts
- Combine with Regional Reserved Instances and Savings Plans to benefit
from billing discounts - You’re charged at On-Demand rate whether you run instances or not
- Suitable for short-term, uninterrupted workloads that needs to be in a specific AZ
Price Comparison
Example – m4.large – us-east-1
AWS charges for IPv4 addresses
- Starting February 1st 2024, there’s a charge for all Public IPv4 created in your account
- $0.005 per hour of Public IPv4 (~ $3.6 per month)
- For new accounts in AWS, you have a free tier for the EC2 service: 750 hours of Public IPv4 per month for the first 12 months
- For all other services there is no free tier