EC2 Flashcards
Three things about EC2
_ compute capacity
AWS services _
It takes _
- EC2 is a resizable compute capacity
- AWS services use EC2 instance as a back end
- EC2 takes minutes to launch new instances
The 5 types of EC2 instances (intention)
- General Purpose
Web servers and code repositories, Balance of compute - Computer Optimized
Scientific modeling, dedicated gaming servers and server engines, High performance processor - Memory Optimized
In-memory caches, in-memory databases, real time big data analytics, Fast performance for workloads that process large data sets in memory - Accelerated Optimized
Machine Learning, computational finance, seismic analysis, speech recognition, Hardware accelerators or co-processors - Storage Optimized
NoSQL, In-memory or transactional databases, data warehousing, High sequential read and write access to very large data sets on local storage
EC2 instances types t2 - small - medium - large - xlarge
What’s happen with the price and key attributes when increasing instance size?
EC2 instance sizes generally double in price and key attributes
In EC2, What is the recommended way to handle AWS credentials for instances?
Assign a role to the instance
You want to always avoid embedding your AWS credentials when possible
Instead of embedding your AWS credentials (Access Key and Secret) in your code so your instance has permissions to access to certain services you can attach a role to an instance via an Instance Profile
An instance profile defines “who am I?” Just like an IAM user represents a person, an instance profile represents EC2 instances. The only permissions an EC2 instance profile has is the power to assume a role. So the EC2 instance runs under the EC2 instance profile, defining “who” the instance is.
In EC2, Which placement group type places instances on different physical racks?
Spread
- Each instance is placed on a different rack
- Spreads can be multi-AZ
In EC2, What are 3 types of placement group configuration?
- Cluster
(AZ > Cluster 1, Cluster 2) - Partition
(AZ > Partition 1 > Cluster 1, cluster 2) - Spread
(AZ > Rack 1, Rack 2)
In EC2, Which placement group type packs instances close together inside an AZ?
Cluster
- Packs instances close together inside an AZ
- Low latency
- Cluster cannot be multi AZ
When you launch a new EC2 instance, the EC2 service attempts to place the instance in such a way that all of your instances are spread out across underlying hardware to minimize correlated failures. You can use placement groups to influence the placement of a group of interdependent instances to meet the needs of your workload. Depending on the type of workload, you can create a placement group using one of the following placement strategies:
Cluster – packs instances close together inside an Availability Zone. This strategy enables workloads to achieve the low-latency network performance necessary for tightly-coupled node-to-node communication that is typical of HPC applications. Partition – spreads your instances across logical partitions such that groups of instances in one partition do not share the underlying hardware with groups of instances in different partitions. This strategy is typically used by large distributed and replicated workloads, such as Hadoop, Cassandra, and Kafka. Spread – strictly places a small group of instances across distinct underlying hardware to reduce correlated failures.
This advanced EC2 option lets you execute a script during the launch of your instance
- As text
- As File
UserData
Advanced Details, ther is a textbox where you can write your script that sets up an apache web-server
UserData for EC2 allows you to execute what kind of script on launch?
(command language)
Bash/Shell
UserData for EC2
After launch, which URL can you curl from an instance to view the UserData script?
http://x.x.x.x/ ??? ???
latest/user-data
EC2
Using curl on this IP address will let you view instance meta-data
What is the IP?
169.254.169.254
EC2 Metadata,
What options can you find in instance metadata?
There are dozens of options
- public ipv4
- ami-id
- instance-type
- mac
- profile
- metrics
- hostname
What is EC2?
What are its 5 components?
- It’s a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.
- Instance types (General purpose, Accelerated…)
- Placements Groups (Cluster, Partition and Spread)
- Instance sizes (micro, medium, large, xlarge)
- UserData (Scripts)
- Instance profiles (Container for an IAM Role)
How do you troubleshoot the encoded authorization failure message?
What action should the Developer perform to make this error human-readable?
Use AWS Security Token Service (AWS STS) to decode the failure message. Then, verify that the AWS Identity and Access Management (IAM) role that ran the restore job has sufficient permissions.
aws sts decode-authorization-message –encoded-message (encoded error message) –query DecodedMessage –output text | jq ‘.’