EC2 Flashcards
EC2 Pricing
- On Demand - pay by the hour or second
- Reserved - 1-3 years, up to 72% discount on hourly charge
- Spot - purchase unused capacity, up to 90% discount, prices fluctuate w/ supply and demand
- Dedicated - a physical EC2 server, dedicated for your use. The most expensive option.
On Demand Benefits
1) Flexible - low cost + no upfront payment/commitment
2) For Short Term, spiky or unpredictable workloads
3) For testing the water, apps being developed or tested for the first time
Reserved Instances Benefits
1) For predictable usage
2) Specific capacity requirements
3) Pay up front (helps reduce computing costs)
4) Commit to 1 or 3 years
5) Super flexible (can also use with Lambda and Fargate)
6) Can be shared across accounts with in an Organization
Types of Reserved Instances
- Standard RI: up to 72% off the On Demand price
- Convertible RI: up to 54% off the On Demand price with option to change to a different RI of equatl or greater value
- Scheduled RI: match your capacity needs to a predictable, recurring schedule that only needs a fraction of a day, week or month
At what level do Reserved Instance operate?
at the regional level
Spot Instances Benefits
1) Flexible - apps that have flexible start and end times
2) Cost sensitive - apps that are only feasible at low compute prices
3) Urgent Capacity - users with urgent need for large amounts of compute (Image rendering, genomic sequencing, algorithmic trading engines)
Dedicated Hosts
- for compliance needs where you need dedicated hardware
- for licensing restrictions
- can be On Demand - reserved hourly
- can be Reserved - purchased as a reservation for up to 70% of the on-demand price
How can you figure out what your hypothetical infrastructure might cost?
AWS Pricing Calculator
AWS CLI Exam Tips
AWS Command Line Interface
- Principle of Least Privilege
- use IAM groups
- Secret Access Key - you only see it once, better save it
- don’t share key pairs
- supported on Linux, Windows, MacOS, and EC2
IAM Roles
- an identity that has specific permissions
Ways IAM Roles are similar to a user
- both are created in IAM
- permission policies determine what it can/cannot do
- IAM policies are global
Ways IAM Roles are different from a user
- not uniquely identified with a person
- intended to be assumed by anyone who needs it
- temporary - when you assume a role it provides you temporary security credentials for your role session
Who can assume roles?
- people
- AWS architecture
- other system-level accounts
- other AWS accounts (for cross-account access)
Example of using an IAM role
1) Create IAM role
2) Create EC2 instance
3) Create S3 bucket
4) Access S3 from the EC2 instance
IAM Roles Exam Tips
- Roles are the preferred option from a security standpoint
- always choose roles over hard-coding credentials
- provide access without using access key IDs and secret access keys
- made up of policies, changes take effect immediately
- you can attach and detach roles without having to stop the EC2 instance
Bootstrap Scripts
- a script that runs when the instance first starts up
- has root permissions
- adds to the time it takes to boot the instance
- allows you to automate the installation of your applications
Example of a Bootstrap Script
- automatically install apache webserver
- when originally configuring your instance, there is a ‘user data’ box at the bottom where you can paste your startup script
Security Group Exam Tips
1) Changes to security groups take effect immediately
2) you can have any number of EC2 instances within a security group
3) you can have multiple security groups attached to an EC2 instance
4) all inbound traffic is blocked by default
5) all outbound traffic is allowed.
EC2 Metadata
Data about your EC2 Instances
- private IP address
- public IP address
- hostname
- security groups, etc.
How do you retrieve Metadata?
with a curl call