EC2 Flashcards
Introduction to EC2
**** Exam Tips *******
launch your EC2 instance lecture:2 read exam Tips
Amazon Elastic compute cloud Ec2 is an webservice that provides resizable compute capacity in the cloud. Amazon Ec2 reduces the time to obtain and boot new server instances to minutes, allowing you to quickly scale capacity, both up and down, as your computing requirements change.
AWS pricing Conclusion : Pay as you go Pay for what you use Pay less as you use more Pay even less when you reserve capacity
EC2 Pricing Models:
* On-Demand:
Allows you to pay a fixed rate by the hour with no commitment
* On-Demand pricing is useful for: Users that want the low cost and flexibility of amazon EC2 without any up-front payment or long term commitment Applications with short term, spiky or unpredictable workloads that cannot be interrupted. Application being developed or tested on Amazon Ec2 for the first time
- Reserved:
Provides you with a capacity reservation and offer a significant discount on the hourly charge for an instance. Contract terms are 1 year or 3 year terms. The more you pay upfront you will save more- Reserved pricing is useful for :
Applications with steady state or predictable work loads.
Applications that requires reserved capacity
Users able to make upfront payments to reduce their total computing costs even further. - There are 3 types of reserved pricing:
1. Standard Reserved Instances: These offers upto 75% off on demand instances. the more you pay upfront and longer the contract, the greater the discount.- Convertible Instances: These offer upto 54% off on demand capability to change the attributes of RI. we can convert between different instance types like T2.
- Scheduled reserved instances: These are available to launch within the time windows you reserve.
- Reserved pricing is useful for :
*Spot:
Enables you to bid whatever price you want for instance capacity, providing for even greater saving if applications have flexible start and end times.
*Spot pricing is useful for: Applications that has flexible start and end times Applications that are only feasible for very low compute prices Users with urgent computing needs for large amounts of additional capacity.
*Dedicated Instances:
Physical EC2 server dedicated for your use. Dedicated hosts can help you reduce costs by allowing you to use your existing server bound software licenses.
- Dedicated Host pricing is useful for:
Useful for regulatory requirements that many not support multi tenant virtualization
Great for licensing which does not support multi tenancy or cloud deployments.
Can be purchased on Demand(hourly)
can be purchased reserved for upto 70% on demand price
* EC2 instance types F --> FPGA I --> IOPS G --> Graphics H --> High Disk Throughput T --> Cheap general purpose (T2)
D --> Density R --> RAM M --> Main choice for general apps C --> Compute P --> Graphics (think pics) X --> Extreme Memory Z --> Extreme Memory and CPU
A --> Arm-based workloads U --> Bare Metal
Security Groups
** Exam Tips **
- Security groups are stateful ( if we add inbound rule no need to add outbound rule it will be automatically allowed)
If you create an inbound rule allowing traffic in, that traffic is automatically allowed back out again.
You cannot block specific IP addresses using Security groups, instead use Network access control lists
You can specify allow rules, but not deny rules
Network access control lists are used in VPC
EBS Volumes (Amazon Elastic block Store)
* Exam Tips ******
Read EBS volume lab exam tips
=============================================================
Amazon Elastic block store(EBS) provides persistent block storage volumes for use with Amazon EC2 instance in the AWS cloud. Each amazon EBS volume is automatically replicated within its availability zone to protect you from component failure, offering high availability and durability.
- 5 different types of EBS Storage
*SSD:
General purpose SSD (GP2) :
GP2 volume that balances price and performance for a wide variety of transactional workloads.
Use case: Most workloads
Provisioned IOPS SSD (IO1):
Highest performance SSD volume designed for mission cortical applications
Use case: Databases
*HDD:
Throughput optimized (ST1) :
Low Cost HDD volume designed for frequently accessed, throughput intensive workloads
Use Case: Big data and data warehouses
Cold HDD (SC1) :
Low cost HDD volume designed for less frequently accessed workloads
Use case: File servers
EBS Magnetic:
Previous generation HDD
Use case: Workloads where data is infrequently accessed.
EBS volume lab tips:
- When we terminate EC2 instance, root volume will also be terminated because, by default root volume termination is enabled on termination of EC2 instance.
- We can modify volume size/EBS volume type, no reboots are required.
- Snapshot is nothing but an copy of EBS volume at that point of time. Snapshot is not AZ specific where as volumes are AZ specific
- How to move an EC2 instance and EBS volume from one AZ to different AZ? Below are the steps
- -) Create an snapshot of the EBS volume(it can be root volume or the normal one)
–) Create an Image from that snapshot.
while creating a snapshot all the values can be default but check there Virtualization type check the video for more details
* Hardware-assisted virtualization (preferred type of virtualization). HVM will provide wide variety of EC2 instance type(FIGHT DRMC PXZ)
* Paravirtual. in here you will see limited instance types
–) Go to AMI Images and launch the EC2 instance with that AMI and select your instance type
–) in the instance details page you can provide the desired availability zone.
- we can copy image/snapshot to different regions
- we can create a volume in a different AZ(us-east-1a) from existing snapshot and can only attach to the EC2 instance in the same AZ(us-east-1a)
AMI Types
**Exam Tips*******
You can select AMI’s based on
*Region
*operating system
*Architecture
*Launch Permissions
*Storage of the root device(root device volume)
–) Instance Store (EPHEMERAL Storage)
For Instance Store volumes: the root device for an instance launched from AMI is an instance store created from template stored in Amazon S3
–) EBS Backed volumes
For EBS volumes: The root device for an instance launched from the AMI is an Amazon EBS volume created from an Amazon EBS snapshot
in instance store ec2 instance you can add additional EBS volumes after launching the instances but you cannot add instance stores after launching.
***** ENI vs ENA vs EFA
Elastic Network Interface
Enhance Networking (ENA)
Elastic Fabric Adapter (EFA)
**Exam Tips*****
- ENI: Elastic Network Interface – Essentially a virtual network card for your EC2 instances. it allows
- -) A primary private IPV4 address from the IPv4 address range of your VPC - -) one or more secondary private IPV4 address from the IPv4 address range of your VPC - -) one elastic IP address (IPV4) per private IPv4 address - -) one public IPv4 address - -) one or more IPv6 address - -) one or more security groups - -) A mac address - -) A source/destination check flag - -) A description
- We use ENI:
- -) Create a management network
- -) Use network and security appliances in your VPC
- -) Create a dual homed instances with workloads/roles on distinct subnets
- -) Create a low budget, high availability solution - EN: Enhanced Networking uses single root I/O virtualization (SR-IOV) to provide high performance networking capabilities on supported instance types.
EN provides higher bandwidth, higher packet per second(PPs) performance, and consistently lower inter-instance latencies. there is no additional charge for using enhanced networking.Use where you want good performance. - EN can be enabled using 2 methodologies
- -) Elastic Network Adapter: ENA which supports network speeds of upto 100GBps for supported instance types
In any scenario question you probably want to choose ENA over VF if given the option
Elastic Fiber Adapter: A network device that you can attach to your amazon EC2 instance to accelerate high performance computing (HPC) and machine learning applications
Encrypted Root Device Volumes and Snapshots
If the root volume is not encrypted,
create a snapshot of the unencrypted EBS volume
create a copy of the snapshot and select encrypt option
Create an AMI using that encrypted snapshot
Spot Instances and Spot Fleets
=> Amazon Ec2 spot instance let you take advantage of unused Ec2 capacity in the cloud.
=> Spot instances are available at 90% discount compared to on-demand price.
=> you can use spot instance for various stateless, fault-tolerant or flexible applications such as big data, containerized workloads, CI/CD, webservers, High-performance computing(HPC) and other test and development workloads.
=> %Spot Price%
=> to use spot instance we must first decide our maximum spot price. the spot instance will be provisioned so long as the spot price is below our maximum spot price.
=> the hourly spot price varies depending on capacity and region => if the spot price goes above your maximum, you have 2 minutes to choose whether to stop or terminate your instance.
=> %% Spot Block %% : you many also use a spot block to stop your stop instances from being terminated even if the spot price goes above your max spot price. you can set spot blocks for between 1 to 6hrs currently
==> Spot instances are not good for
* persistent workloads * databases * Critical jobs
==> How to terminate spot instance go through the video.
==> Spot fleet: A pot fleet is a collection of EC2 instances, and optionally on-demand instances.
==> Spot fleet attempts to launch the number of spot instances and on-demand instances to meet the target capacity you specified in the spot fleet request.
==> the requests for spot instance is fulfilled if there is available capacity and maximum price you specified in the request exceeds the current spot price
==> the spot fleet also attempts to maintain its target capacity fleet if your spot instances are interrupted.
==> Launch pools: spot fleets will try and match the target capacity with your price restraints.
* Set up different launch pools. define things like Ec2 instance type, OS and AZ * you can have multiple launch pools and the fleet will choose the best wat to implement depending on the strategy you define. * spot fleets will stop launching instances once you reach your price threshold or capacity desire.
==> you can have the following strategies with spot fleets
* CapacityOptimized: spot instances come from the pool with optimal capacity for the number of instances launching. * Diversified: The spot instances are distributed across all pools * lowest price: spot instances come from the pool with lowest price * InstancePoolsToUseCount: spot instances are distributed across the number of spot instance pools you specify. this parameter is valid only when used in combination with lowest price.
EC2 Hibernate
**must read Exam tips**
Ec2 Hibernate:
When you hibernate an Ec2 instance, the OS is told to perform hibernation(suspend-to-disk). Hibernation saves the contents from the instance memory(RAM) to your Amazon EBS root volume. we persists the instances Amazon EBS root volume and any attached Amazon EBS data volumes.
==> Hibernation is not enabled by default, while launching EC2 instance we have to “enable hibernation as an additional stop behavior.
==> Starting your Ec2 instance with Ec2 hibernate.
When you start your instance out of hibernation:
* the EBS root volume is restored to its previous state. * the RAM contents are reloaded * processes that were previously running on the instance are resumed. * previously attached data volumes are reattached and the instance retains its instance ID.
==> with Ec2 hibernate the instance boots much faster. the operating system does not need to reboot because the in-memory state(RAM) is preserved. this is useful for
* Long-running process * Services that take time to initialize.
CloudWatch & Cloud trail
Exam Tips for cloud watch tips and lab tips
Amazon cloud watch is a monitoring service to monitor your aws resources as well as the application that you run on aws.
- Cloud watch monitor performance
- Cloud trail monitors the API calls in the Aws platform
Cloud watch can monitor things like ==> Compute * Ec2 instances * Autoscaling groups * Elastic load balancers (ELB) * Route 53 health check
==> Storage and content delivery
* EBS volumes * Storage gateways. * Cloud front.
Cloud Trail: Aws Cloud trail increases the visibility into your user and resource activity by recording AWS management console actions and API calls. you can identify which users and accounts called AWS, the source IP address from which the calls were made, and when the calls are occurred.
IAM Roles
Read Exam tips
Using Bootstrap scripts
Read Exam tips
Instance Metadata
Read Exam tips
EFS
Amazon elastic filesystem is a file storage service for amazon EC2 instances. EFS is easy to use and provides a simple interface that allows you to create and configure file systems quickly and easily. with amazon EFS, storage capacity is elastic, growing and shrinking automatically as you add and remove files, so your applications have storage when they need it.
== > EFS is under Storage
==> in the EC2 security groups, we need to make sure the NFS port 2049 port is opened so that EFS can talk to Ec2 instances.
Amazon FSX for windows and Amaozn FSX for Lustre
sdas
EC2 placement Groups
sadsd