EC2 Section Flashcards
EC2
• EC2 = Elastic Compute Cloud = Infrastructure as a Service
It mainly consists in the capability of :
• Renting virtual machines (EC2)
• Storing data on virtual drives (EBS)
• Distributing load across machines (ELB)
• Scaling the services using an auto-scaling group (ASG)
EC2 User Data
- It is possible to bootstrap our instances using an EC2 User data script.
- That script is only run once at the instance first start
- EC2 user data is used to automate boot tasks
EC2 Naming Convention
m5.2xlarge
- m: instance class
- 5: generation (AWS improves them over time)
- 2xlarge: size within the instance class
EC2 Instance Types – General Purpose
• for web servers or code repositories
Balance between:
• Compute
• Memory
• Networking
EC2 Instance Types – Compute Optimized
compute-intensive tasks that require high performance processors: • Batch processing workloads • Media transcoding • High performance web servers • High performance computing (HPC) • Scientific modeling & machine learning • Dedicated gaming servers
EC2 Instance Types – Memory Optimized
• Fast performance for workloads that process large data sets in memory
Use cases:
• High performance, relational/non-relational databases
• Distributed web scale cache stores
• In-memory databases optimized for BI (business intelligence)
• Applications performing real-time processing of big unstructured data
EC2 Instance Types – Storage Optimized
• Great for storage-intensive tasks that require high, sequential read and write
access to large data sets on local storage
Use cases:
• High frequency online transaction processing (OLTP) systems
• Relational & NoSQL databases
• Cache for in-memory databases (for example, Redis)
• Data warehousing applications
• Distributed file systems
Security Groups
- They control how traffic is allowed into or out of our EC2 Instances (firewall)
- Locked to a region/VPC but can be attached to multiple instances
- only contain allow rules
- rules can reference by IP or by security group
- All inbound traffic is blocked by default
- All outbound traffic is authorised by default
They regulate:
• Access to Ports
• Authorised IP ranges – IPv4 and IPv6
• Control of inbound network (from other to the instance)
• Control of outbound network (from the instance to other)
Ports to know
- 22 = SSH (Secure Shell) - log into a Linux instance
- 21 = FTP (File Transfer Protocol) – upload files into a file share
- 22 = SFTP (Secure File Transfer Protocol) – upload files using SSH
- 80 = HTTP – access unsecured websites
- 443 = HTTPS – access secured websites
- 3389 = RDP (Remote Desktop Protocol) – log into a Windows instance
SSH
• allows you to control a remote machine, all using the command line
EC2 Instance Connect
- Connect to your EC2 instance within your browser
- No need to use your key file that was downloaded
- The “magic” is that a temporary key is uploaded onto EC2 by AWS
- Works only out-of-the-box with Amazon Linux 2
- Need to make sure the port 22 is still opened
EC2 On Demand
Pay for what you use:
• Linux or Windows - billing per second, after the first minute
• All other operating systems - billing per hour
- Has the highest cost but no upfront payment
- No long-term commitment
- Recommended for short-term and un-interrupted workloads
EC2 Reserved Instances
- Up to 72% discount compared to On-demand
- Reservation period: 1 year = + discount | 3 years = +++ discount
- Reserve a specific instance type
Convertible Reserved Instance
• can change the EC2 instance type
• Up to 45% discount
Scheduled Reserved Instances
• launch within time window you reserve
• When you require a fraction of day / week / month
• Commitment for 1 year only
EC2 Spot Instances
- Can get a discount of up to 90% compared to On-demand
- Instances that you can “lose” at any point of time if your max price is less than the current spot price
- The MOST cost-efficient instances in AWS
- Useful for workloads that are resilient to failure
EC2 Dedicated Hosts
- physical server with EC2 instance capacity fully dedicated to your use. can help you address compliance requirements and reduce costs by allowing you to use your existing server-bound software licenses.
- Allocated for your account for a 3-year period reservation