Advanced EC2 Flashcards
What is Bootstrapping?
When scripts or other predefined bits of information can be automatically run and applied when an instance is first launched.
REPEAT –> ONLY HAPPENS AT LAUNCH
The instance is brought into service in a certain, pre-defined state.
How is Bootstrapping applied?
EC2 User Data
This is user metadata that can be queried by EC2 when bootstrapping.
What is the universal IP/URL used to retrieve the User metadata needed for bootstrapping an instance?
169.254.169.254/latest/user-data
REVIEW: Instance Metadata is 169.254.169.254/latest/meta-data
Does EC2 check the User Data before passing it to the instance OS?
NO.
EC2 simply takes the data and passes it without interpretation. The data is passed to the OS which runs it in full privilege mode.
What is “post-launch time” ?
When you launch an instance based on an AMI, and then you need to add additional SW features, the added time it takes to get the instance up and running makes up this “post launch time”
Automating that post-launch process is what Bootstrapping is all about.
What combination of features accelerates the launch time of an EC2?
AMI Baking + Bootstrapping (90% : 10%)
Baking does some of the post-launch config ahead of time, so it’s “baked” into the AMI (like parameters around hosting a Word Press website). Then anything small/additional can be done via Bootstrapping.
What is CFN-INIT?
Cloudformation Init
Method for passing complex bootstrapping instructions to an EC2.
What does CFN-INIT do?
It outlines the “Desired State” of what we want that instance to be, and then EC2 will perform whatever is required to move that instance into that desired state.
EC2 get’s these instructions from a CFN template.
What is a main benefit of CFN-INIT versus regular Bootstrapping with User Data?
CFN-Init also works with ongoing stack updates, where User Data only works once @ the time of instance launch.
CFN-Init can be set to watch for any changes in the metadata on an object within an CFN template, and if there are changes, update the config of that instance to the newly desired state specific in the template.
You CAN’T do this with User Data/Bootstrapping
What is a Creation Policy?
Something added to a logical resource within a CFN template which acts like a post-configuration check to tell CFN if the resource was actually stood up successfully.
By default, CFN just passed information and has no way of actually knowing whether or not the resource (with added/customized config parameters) was stood up successfully.
CFN will wait for a signal from the resource itself; even though EC2 tells CFN it’s good to go and the 2 x system checks are passed, it won’t be listed as complete until it get’s the OK signal from the resource.
What is an EC2 Instance Role?
IAM Role that an instance can assume, where anything running on that instance has the set permissions that the Role grants.
Review - Roles are best for allowing Services access to other Services in AWS.
What is an Instance Profile?
The aspect of an EC2 which allows the permissions granted by a Role to get into/be accessible by the EC2 i.e facilitates the short-term credentials to the EC2 to use for assuming the Role.
REVIEW: IAM Roles issue temporary/short-term credentials to users accessing them.
Do you have to manually rotate access keys when using an Instance Role?
NO.
EC2 will automatically rotate/renew the keys/credentials before they are retired so they’re always valid.
As long as the Apps inside the EC2 keep checking the metadata (Instance Profile), they will always have the renewed credentials.
What are the 3 types of Placement Groups?
Cluster
Spread
Partition
EC2 Cluster Placement Groups:
- Used when you want the highest level of performance possible in EC2
- puts resources physically close together on the same HW or at least in the same rack of HW
- Best practice is to use instances of the same type and size, and then launch all instances at the same time
- All members in the cluster have direct connections to each other; up to 10 Gbps (single stream)
** Use Case: high performance applications **