M6: Compute Flashcards
Module 6
Four broad categories of compute services
VMs (IaaS)
Serverless
Container based
Platform as a service
EC2
Elastic: can increase / decrease
Compute: processing power and memory
Cloud
AMI
Template for root volume of instance
Launch permissions re which AWS accounts can use AMI
Block device mapping specifying the volumes to attach to instance
Creating a new AMI
Instance is stopped
Snapshot taken of root volume
Register snapshot as AMI
(Optionally copy AMI to other regions)
Launching EC2
- Select AMI
- Choose instance type
- Specify network location, deciding re public IP if in non default VPC
- Can attach IAM role to EC2 instance at this point or later
- Can pass user data to the instance
- Can config storage options
- Can assign tag
- Can specify one or more security groups, default used otherwise, can change after launch. Can add rules to security groups, all are evaluated.
- Key pair
Instance type
Varying combinations of CPU, memory, storage and networking capacity. Network bandwidth is also related to the size of the instance.
Running user data
Default: only first time instance starts up
Can write MIME multipart file user data script to run every time instance is booted
Amazon Elastic Block Store
Block storage designed for throughput and transaction intensive workloads
Instance store
Ephemeral block level storage, good for temporary content such as buffers
Elastic file system
Simple, scalable, fully managed NFS
Grows and shrinks automatically
Amazon S3
Object storage service
aws ec2 run-instances
image-id count instance-type key-name security-groups region
If no subnet id given, the default is chosen
Public IP address
Released when instance is stopped or terminated
Automatically assigned from pool if public IP chosen
Can go for elastic IP address instead
Elastic IP address
Allocate one in same region as instance
Max 5 per region
Associate with EC2 instance
Instance metadata URL
http://169.254.169.254/latest/meta-data/
Amazon CloudWatch
Collects and processes raw data from EC2
Stores for 15 months
EC2 pricing models
On-demand instances Reserved instances Spot instances: interrupted with 2 minute warning Dedicated instances Dedicated hosts
Four pillars of cost optimization
Right size
Increase elasticity
Optimal pricing model
Optimize storage choices
On-demand instances
Lowest upfront cost
Greatest flexibility
Good for short-term, spiky, or unpredictable workloads
Dedicated hosts
Physical servers with instance capacity dedicated to your use
Can use existing per-socket, per-core or per-VM software licences
Dedicated instances
Instances that run in a VPC on hardware that is dedicated to a single customer
Reserved instances
Reserve computing for 1 or 3 years at lower hourly running cost
Good for consistent, heavy use
Scheduled reserved instances
Capacity reservations that recur on a daily, weekly, monthly basis with a specified duration for 1 year
Spot instances
Bid on unused instances
Good if applications can tollerate 2 minute notification to interruption
Containers
Hold everything an application needs, not a full OS
Single application can span multiple containers
Docker
Software platform that packages software into containers. Useful when want to
- standardise environments
- reduce conflicts between language stacks and versions
- use containers as a service
- run microservices using standardized code deployments
- require portability for data processing
Amazon Elastic Container Service
Orchestrates execution of Docker containers
Create a task definition - text file describing one or more containers, parameters for application
Uses the task scheduler
When ECS runs the containers that make up your task, it places them on an ECS cluster
Kubernetes
Open source software for container orchestration
Manages a cluster of compute instances called nodes
Amazon Elastic Kubernetes Service
Run Kubernetes on AWS instead of managing and running Kubernetes yourself
Amazon Elastic Container Registry
Store, manage, and deploy your Docker containers
ECS cluster
Networking only cluster (powered by Fargate)
EC2 Linux & networking cluster
EC2 Windows & networking cluster
Lambda payments
Pay for requests that are served and the compute time that is required to run the code
Billed in 100 milliseconds
Creating Lambda function
- Name
- Runtime environment (version of python)
- Execution role (IAM permissions)
- Trigger
- Add function code
- Memory requirements
- Specific environment variables, description, timeout (all optional)
AWS Elastic Beanstalk
PaaS facilitating quick deployment, scaling and management of Web applications and services. Choose: - instance type - your database - set and adjust automatic scaling - update application - access server log files - enable HTTPS on load balancer