Elastic Compute Cloud (EC2) Flashcards
What is Elastic Compute Cloud (EC2)?
In it’s essence it’s a virtual machine that’s hosted in AWS instead of your own data center.
It’s designed to make web-scale cloud computing easier for developers at the capacity you want when you need it.
You can select the capacity you need right now and grow/shrink the service when you need it.
What are the 4 EC2 pricing options?
1 On-Demand
- Pay by the hour or second, depending on the type of instance you run
- Reserved
- Reserved capacity for 1 or 3 years. Up to 72% discount on the hourly charge. - Spot
- Purchase unused capacity at a discount of up to 90%. Prices fluctuate with supply and demand. - Dedicated
- A physical EC2 server dedicated for your use. The most expensive one.
When do you want a on-demand pricing model for instances?
In general you want this in 3 different scenario us:
- You need flexibility in capacity, and you don’t want to do upfront payment or long-term commitment.
- You need something for the short term, and your workloads are going to be very unpredictable.
- You are testing the waters and you’re testing your application for the first time.
When do you want a reserved pricing model for instances?
This basically the opposite of when you want the on-demand pricing model.
- You have predictable usage, so you know what you’re gonna use for the next 1 or 3 years.
- Your application have specific capacity requirements so you know what the capacity is gonna be.
- You want to reduce your computing cost since reserved is cheaper than on-demand (up to 72% depending contract length).
What are the different options of reserved EC2 instances?
- Standard - Pick one type of instance and stick to that one.
- Convertible - You can change your reserved instance type at the cost of only up to 52% discount of on-demand instances.
- Scheduled - Reserve only capacity within a timeframe you define. Like maybe you only need a large amount of reserved capacity in the morning when people log in.
When do you want to use Spot pricing for instances?
You generally want to use Spot pricing when your application is very flexible about it’s schedule. So it doesn’t really matter if it runs Monday afternoon or Saturday morning. And you want to be as cost sensitive as possible, since you can just buy capacity when it’s at its cheapest.
A side note is they can be useful for users with an urgent need for large amounts of additional computing capacity.
When do you want to use a dedicated host pricing mode for your instances?
- Compliance requirements
- Multiple people on AWS use the same hardware to run their instances. There might be some govermental rules or something like a bank might have a rule that says you need to have your data on dedicated hardware and not shared. - Licensing requirements
- The same as compliance. You might have licenses from Microsoft or Oracle that demand you have dedicated and not share hardware. - Can be purchased both as a on-demand and reserved pricing models.
Which tool can you use to estimate AWS pricing?
The AWS pricing calculator.
How do you elevate your permissions to root using the command line in an instance?
sudo su
How do check for updates in an instance using the command line?
dnf update -y
How do you configure ine command line?
First you need to create an access key and secret access key in IAM and tick of the user needs access to the AWS CLI.
The you go to the command line and type the command:
aws configure
and provide the credintials you created in IAM.
What is an IAM Role?
A role is an identity you can create in IAM that has specific permissions. A role is similar to a user, as it’s and AWS identity with permission policies that determine what the identity can and cannot do in AWS.
Roles are intended to be assumable by anyone who needs it.
A special feature of roles is it can allow cross-account access. This allows one AWS account the ability to interact with resources in other AWS accounts.
They are also preffered from a security perspective, so you would always prefer to use roles rather than hardcode credintials if possible.
Are roles permenanet?
No, A role does not have standard long-term credentials the same way password or access keys do. Instead, when you assume a role, it provides you with temporary security credntials for your role session.
Who can assume roles?
Roles can be assumed by people, AWS architecture, or other system-level accounts
Why is it more secure to assign an instance a role with permissions and do you work from there rather than the main account?
The reason is the instances don’t store Credintials. If the instance should get hacked, the hacker can only do what that instance is allowed to do thorugh it’s role. And you can just terminate the instance and the hacker loses access.
If the account is hacked on the other hand they will have access to your access key and secret access key, and they can do pretty much anything they want, and not only what the instance was allowed to do.