Compute Flashcards
1
Q
What is EC2?
A
Elastic Cloud Compute
- Web service that provides resizable compute capacity in the cloud
- Reduces time needed to obtain and boot new server instances to minutes, allowing quick scale capacity, as compute requirements change
- Four types of pricing
- On Demand
- Reserved
- Spot
- Dedicated Hosts
2
Q
EC2 - On Demand
A
- Pay fixed rate by the hour with no commitment
- Good for spinning up for a few hours to testing something then shutting down
- Also useful for:
- Users that don’t want up-front payment or long-term commitment
- Apps with short-term, spiky/unpredictable workloads that cannot be interrupted
- Apps being developed or tested on EC2 for the first time
3
Q
EC2 - Reserved
A
- Provides capacity reservation, with significant discount on hourly rate
- Contract terms are 1 to 3 years
- Useful for:
- Apps with stead/predictable usage
- Apps that require reserved capacity
- Can pay upfront to reduce costs further
- Pricing:
- Standard: up to 75% discount off On Demand. More paid upfront and longer the contract, the cheaper
- Convertible: up to 54% discount off On Demand. Allows switching between instance types (e.g. higher RAM, CPU etc)
- Scheduled: available to launch within time windows you reserve. Can match capacity with a predictable schedule
4
Q
EC2 - Spot
A
- Enables price bidding for instance capacity, providing for even greater savings if your apps have flexible start and end times
- Is essentially left-over compute not used by others. Price goes up/down depending on supply
- Useful for:
- Apps with flexible start/end times
- Apps that are only feasible at very low compute prices
- Users with urgent computing needs for large amounts of additional capacity
- If AWS terminate an instance, you are not charged the whole hour, however if you terminate, you are charged the hour
5
Q
EC2 - Dedicated hosts
A
- Physical EC2 server dedicated for you use
- Can help reduce costs by allowing you to use your existing server-bound software licences (e.g. Oracle). Useful for:
- Regulatory requirements that don’t support multi-tenant virtualisation
- Licensing which does not support multi-tenant or cloud deployments
- Can be purchased On-Demand
- Can be purchased as a Reservation
6
Q
Launching an EC2 instance
A
- Termination protection is turned off by default, must turn it on
- On an EC2-backed volume, the default action is for the root EBS volume to be deleted when the instance is terminated
- EBS Root Volumes of your DEFAULT AMIs can be encrypted. You can also use a third-party tool (e.g. bit locker) to encrypt the root volume
- Additional volumes can be encrypted
7
Q
Security Groups
A
- All inbound traffic is blocked by default - but you can enable individual ports
- All outbound traffic is allowed
- Changes to security groups take effect immediately
- You can have many EC2 instances in one security group
- You can have multiple security groups attached to EC2 instances
- Security groups are stateful - inbound changes are reflected in outbound traffic
- You cannot block specific IP addresses using Security Groups - use a NACL instead
- You can specify allow rules, but not deny rules
8
Q
EBS
A
- Like a virtual hard disk in the cloud
- Provides persistent block storage volumes for EC2 instances
- Each EBS volume is automatically replicated within its AZ to protect you from component failure
Acronyms: - IOPS: input output per second
- SSD: solid-state drives
- HDD: hard-disk drives
9
Q
5 types of EBS storage
A
- General purpose: SSD; most workloads; API name: gp2; up to 16k IOPS/volume
- Provisioned IOPS: highest performing SSD; use: Databases; API Name: io1; up to 64k IOPS/volume
- Throughput Optimised Hard Disk Drive:: HDD; low cost, frequently accessed; use: big data and warehouses; API Name: st1; up to 500 IOPS/volume
- Cold Hard Disk Drive: HDD; lowest cost, for less frequently access; use: file servers; API name: sc1; Up to 250 IOPS/volume
- Magnetic: previous generation HDD; use: workloads where data is infrequently accessed; API name: Standard; 40-200 IOPS/volume
10
Q
Volumes and Snapshots
A
- An EBS volume is the block-level storage you attach to an EC2 instance, like a hard drive
- Snapshots can be taken of volumes and stored on S3. They are like a photograph of the disk taken at a point in time
- Snapshots are incremental: only blocks that have changed since your last snapshot are saved on S3
- If taking a snapshot of an EBS volume that servers as a root device, you should stop the instance first
- You can create AMIs from snapshots, which provides the configuration required to launch an instance
11
Q
Volumes and Snapshots 2
A
- You can change EBS volume sizes on the fly, including changing the size and storage type
- Volumes with ALWAYS be in the same AZ as the EC2 instance
- To move and EC2 volume from one AZ to another, take a snapshot of it, create an AMI from the snapshot and then use the AMI to launch the EC2 instance in the new AZ
- To move an EC2 volume from one region to another, take a snapshot, create an AMI from the snapshot and then copy the AMI from one region to another. Then use the copied AMI to launch the new EC2 instance in the new region
12
Q
AMI selection options
A
You can select your AMI based on:
- Region (or AZ)
- OS
- Architecture (32-bit or 64-bit)
- Launch permissions
- Storage for the root device:
- Instance store (ephemeral storage)
- EBS backed volumes
13
Q
EBS vs Instance Store
A
All AMIs are categorised as either backed by EBS or instance store:
- For EBS volume: the root device for an instance launch from the AMI is an EBS volume created from an EBS snapshot
- For instance store: the root device for an instance launched from the AMI is an instance store volume created from a template stored in S3
- Instance store volumes are also called ephemeral storage because when you delete the instance you lose all data stored as well
- Instance store volumes cannot be stopped. You will lose all data if it is stopped
- EBS-backed instances can be stopped. You will not lose all data if stopped
- You can reboot both and not lose data
- By default, both ROOT volumes with be deleted on termination. However, with EBS volumes you can tell AWS to keep the root device volume
14
Q
ENI vs ENA vs EFA
A
- ENI: Elastic Network Inference. Essentially a virtual network card. For basic networking
- E.g. if you need separate, low cost networks for different functions such as management, production, logging etc. You could use multiple ENIs for each network
- EN: Enhanced Networking. Uses single root I/O virtualisation to provide high-performance networking capabilities on supported instance types.
- For when you need speeds between 10Gbps and 100Gbps. Anywhere you need reliable, high throughput
- EFA: Elastic Fabric Adapter. A network device that you can attach to you EC2 instance to accelerate High Performance Computing (HPC) and ML applications
15
Q
Encrypted root device volumes and snapshots
A
- Root device volume: the EBS volume that has your OS stored on it
- Snapshots of encrypted volumes are encrypted automatically, as are volumes restored from encrypted snapshots
- You can only share UNencrypted snapshots (i.e. with others or made public)
- You can encrypt root device volumes upon creation of the EC2 instance
To encrypt an already-created unencrypted root device volume:- Create a snapshot of the unencrypted root device volume
- Create a copy of the snapshot and select the encryption option
- Create an AMI from the encrypted snapshot
- Use that AMI to launch new encrypted devices