Module 4 - Compute & Lambda Flashcards
What is Amazon ECS?
Amazon Elastic Container Service (Amazon ECS)
What is EC2?
Elastic Compute Cloud, a service to create and run virtual machines.
What is Amazon EKS?
Elastic Kubernetes Service
What is AWS Lambda?
Serverless computing, no provisioning of EC2 instances.
What is AWS Fargate?
A serverless compute engine for containers that works with Amazon ECS and Amazon EKS.
Rank the following in order of most to least effort to manage: EC2, Lambda, EKS/ECS, Fargate.
EC2, ECS/EKS, Fargate, Lambda
What is an AMI? What is one restriction on it?
Amazon Machine Image, contains the information you need to deploy an instance. It’s a recipe for instances.
Built for a specific region. You can’t launch into another region, but you can COPY across to another region.
What is included in an AMI?
- A template for the root volume for the instance (for example, an OS, an application server, and applications)
- Launch permissions that control which AWS accounts can use the AMI to launch instances
- Block device mapping that specifies the volumes to attach to the instance when it’s launched
Where can you get an AMI?
Prebuilt Amazon ones, AWS marketplace, build your own.
What tools can you use to customize your own AMI?
Chef, Puppet, cloud-init.
How do you create an AMI?
Launch an EC2 instance and customize it to meet your requirements.
Stop it (for data integrity)
Then, save that configuration as a custom AMI. Instances launched from this custom AMI will use all your customizations.
What do you need to consider when building your own AMI? (10 things)
- Software packages and updates
- Password policies
- SSH keys
- File system permissions and ownership
- File system encryption
- User and group configuration
- Access control settings
- Continuous monitoring tools
- Firewall rules
- Running services
What is Amazon EC2 Image Builder?
A service that allows you to automate the creation and management of server images.
How do you use EC2 Image Builder?
Start with a source image.
Customize the software/configurations
Secure it with AWS or other security templates
Test it with AWS or custom tests
Disctribute the “golden image” to the region.
What are the 3 ways that an EC2 instance can occupy a physical machine?
Shared tenancy: multiple AWS accounts on the same hardware
Dedicated Instance: Isolated from shared tenancy instances and from other AWS accounts
Dedicated Host: the whole server, everything are belong to us
Explain the parts of the instance type name:
c5n.xlarge
c = instance family 5 = instance generation n = attribute xlarge = instance size
Why do you need to choose an instance family?
You choose a family to suit the workload you are deploying. Saves time and cost.
What are the different instance families?
- General purpose,
- Memory-optimized (large data sets, dbs, caches)
- Storage-optimized (large data sets, NoSQL)
- Compute-optimized (high performance)
- Accelerated compute (graphics, ML, autonomous cars)
Which instance generation should you choose?
The latest one will be the best performance with the lowest cost.
How do I know if I have chosen the right instance details?
Use AWS Instance Optimizer which:
- Identifies whether your AWS resources are optimal and offers recommendations to improve cost and performance
- Uses ML to analyze the current configuration of your resources and your usage data from CloudWatch to generate recommendations
What is EBS?
Elastic Block Store (Amazon EBS) is a scalable, high-performance block-storage service. EBS volumes are limited to 1 TB and can be attached to only a single EC2 instance. They are super low latency, so you can run a db with the instance. You can use them as boot volumes or data volumes.
What is the difference between S3 and EBS?
Both are storage systems.
S3 is accessed via the internet using APIs; uses an object storage system with keys.
EBS is accessed by the single instance attached to EBS, uses a traditional file system, works like a local disk drive (like your c: drive). More expensive.
What is the difference between rebooting and stopping & starting an EC2 instance?
Rebooting: like an OS reboot. Keep the public DNS name, private IP address, and any data on the INSTANCE store volumes. You are still charged.
Stop/start:
•You can only stop and start EC2 instances that are backed by Amazon EBS.
• No charge for a stopped instance, but the EBS is still attached and will cost money.
• Stopping sends the instance back to the beginning of the lifecycle, it will get a NEW host machine so you lose the instance store volumes (RAM).
• When an instance is stopped you can change its attributes.
How can you pass user data to your EC2 instance and why would you do that?
Pass user data to the instance in a shell script or cloud-init command. You can use the data to perform automated configuration tasks like getting software license keys.
What is instance metadata?
Information about the instance that you use to configure or manage it. You can only get metadata from that instance (i.e. not a public block). curl //http://169.254.169.254/latest/meta-data/
How do you securely access an EC2 instance?
First, you generate a key pair with a public and private key. The public key is stored on the EC2 instance. You keep the private key and use it instead of a password.
What is an EC2 tag and why would you use them?
Tags are a way to assign custom metadata to an instance. The tag is a key-value pair, and they are handy to use for searching and filtering. E.g. stop all instances with the tag “dev2”
What is a launch template and why would you use one?
It’s a way to keep all the launch parameters together to simplify creating an instance. Makes the process easy to reproduce, maintains standards, minimizes errors.
What is in a launch template?
BUTIII • AMI ID • Instance type • Network interfaces • Block device mapping • User data • Tags etc.
What are the 4 EC2 pricing options?
- On-demand instances (pay for use by the second (Linux/Windows) or hour (all other OSs)
- Reserved Instances ( 1 OR 3 years; discount)
- Savings Plans (1 OR 3 years): commit to compute capacity
- Spot Instances
When would you use On-Demand pricing?
When you are just starting and don’t know your needs yet. When you have unpredictable workloads. Highest cost, but no commitments.
When would you use a Reserved Instance price?
When you have steady, predictable usage, and you can make a LONG-term commitment (1 OR 3 years). 54-72% discount. E.g. a database.
You can buy/sell reserved instances in the marketplace if you no longer need them.
When would you use a Savings Plan for an EC2 instance?
When you can make a long-term commitment but need more flexibility. You can change the size, OS, and tenancy. For more money, you can change instance family, region, and compute options.
When you can commit to a certain type of usage (e.g. $10/hour for 3 years). Anything you use beyond that is billed at on-demand pricing.
Locked to an instance family & region.
What are spot instances and how do they work?
These are instances that spin up when AWS has the extra capacity and the current price is less than your max price. You put in a request with your price and specifications, and AWS will spin it up when the conditions are met. They will give you a 2-minute warning before terminating.
When would you use a spot instance?
Anything in a container, AI, ML, Big Data, Web services…. Anything with short workloads, fault-tolerant, loosely coupled, or stateless.
What is the lifecycle of EBS?
- Call CreateVolume (1 GiB to 16 TiB)
- Call AttachVolume to affiliate with one EC2 instance.
- Use it: Format from EC2 instance OS and mount formatted drive.
- Create a snapshot and save to Amazon S3 (great if you need to carry to another AZ or region).
- Call DetachVolume.
- Call DeleteVolume
What are the different types of EBS volumes? There are 2 major types, each with 2 subtypes.
SSD(general purpose/provisioned) and HDD.
small/random I/O vs. large/sequential I/O
bootable volume vs. NOT bootable
for transactional workloads vs. large streaming workloads
What is an instance store?
Temporary block-level storage for your instance that lives on the disks on the physical host computer.