-
Notifications
You must be signed in to change notification settings - Fork 0
EC2 Basics
EC2 BASIC
- AMI, Instance type, Network Interface, Storage
- Firewall (Security Group) is required (protocol, port number etc)
- Each instance must be placed in VPC, AZ and subnet.
- Tags can be used to organize
- Encrypted key-pairs are used to manage login auth
- There are limits on number of instances you can have running in a region at any particular time.
Shared tenancy isolation: ————————————
- Multiple customers can share same physical host machine.
- EC2 instances come in different sizes.
- Shared Host resources - Basically the RAM, CPU etc are shared across multiple EC2 (with different customers) and that is done by hypervisor.
AMI —-—
- OS image containing files that are installed so it boots.
- HVM AMIs (Hardware Virtual Machine )
- They can take advance of h/w extensions etc
- PV AMIs (ParaVirtualized instance).
- They can’t take advantage of special h/w extensions such as GPU processing , networking etc.
EC2 types ———————
Number after letter represents the generation of the type.
- M5 - General purpose Balance of compute, memory, network - Midsize DB
- C5 - compute optimized Advanced CPUs - Modelling analytics
- H1 - storage optimized Local HDD storage - Map reduce
- R4 - Memory optimized More RAM - In memory caching
- X1 - Memory Optimized Terabytes RAM - In memory database
- I3 - I/O Optimized Local SSD, high IOPS - NoSQL DB
- G3 - GPU graphics GPUs with encoders - 3d Rendering
- P3 - GPU compute GPUs with tensor cores - Machine learning
- F1 - Accelerated computing FPGA, custom h/w - Genomics
- T2 - Burstable (shared CPU, lowest cost). - Webservers
Elastic IP address (EIP): ———————————
EIP is static IPv4 address designed for dynamic cloud computing
- EIP is public IPv4 address
- With an EIP you can attach public IP address to an EC2 instance that was created with only private address OR
- Can mask the failure of instance
- Attaching EIP to an instance WILL replace it’s default public IP address for as long as it’s attached.
Three primary ways to access files from the Ec2 instances. ————————————————————————————
SSD - c3, f1, g2, i3,m3, r3, x1 HDD - h1, d2 EBS only - t2, m4, m5, c4, g3, p2, p3, r4
Instance store - SSD mounted in host server (connected to hardware). * Local storage * Can be used as boot or secondary vol * Faster IOPs 3.3 Million read / 1.4 Million write IOPS * Ephemeral data * Once stopped, shutdown - data is erased. * Suitable for paging, swap, caching and replicated NoSQL data.
EBS (Elastic Block Storage)
-
They are persistent
-
Outside the host machine and EC2 connects over network.
-
Only one server will be using it at a time.
-
EBS optimized network interface (not the regular one) is used to connect to EBS volume (external).
-
EBS volumes can be backed up in S3 (Snapshots).
-
SSD
- GP2 - general purpose (high IOPs - GP2 SSD - 32000 IOPS/volume
- Use for dev/test and most workloads
- Base perf = 3 IOPs/GB
- Bursts up to 3000 IOPS
- 1G to 16TB
- IO1 - Provisioned IOPs (io1) - 64000 IOPS /volume
- GP2 - general purpose (high IOPs - GP2 SSD - 32000 IOPS/volume
-
Hard disk drives
- ST1 - Throughput optimized
- Low storage cost
- Used for frequently accessed, throughput intensive (streaming, big data)
- Can NOT be boot volume
- 500G to 16TB
- EC2 instances have max throughput of 1750 MB/s
- SC1 - Cold HDD
- Lowest cost
- Can NOT be boot volume
- 500G to 16TB
- Max throughput of 250MB/s
- ST1 - Throughput optimized
EFS - Network file share where multiple EC2s can do to NFS mount.
- Can’t use for boot volume.
Security Groups ———————
- One min per EC2 instance.
- More than one can be added to EC2
- Deny all by default.
- 0.0.0.0/0 - From anywhere in the world you can access the EC2 instance. (You don’t want this).
Purchase instances ——————————
-
On-demand (standard way)
- 60 seconds, minimum
- Licensed, pay by hour (where per second is not indicated)
- Most expensive option
- If you turn off during night, can be cheaper
-
Reserved
- Option to reserve capacity, in specific AZ
- Standard RI ((75% discount)
- Convertible (54% discount)
- Scheduled (5-10% discount)
- 1 or 3 year, you will be charged for that period. If your project is cancelled, you will have to pay.
- RI marketplace.
- Like stock market, RI marketplace, you can list there.
- Customers can buy this RI instance and will be transferred from old leaser to new lease owner.
-
Spot Instances
- Spot price is price you pay for instance, that is based on supply and demand.
- This is like stock market.
- Put a request for spot for max price you are willing to pay. Can fluctuate based on demand and supply.
- If you don’t want to be interrupted, request something called “Spot Block”.
- Fixed discount and depending on time of day and number of hours, just have block.
- Use case like batch processing, EMR task nodes, compute intensive simulations
- EMR map reduce (Hadoop cluster) to process data.
-
Consolidated billing (Just a billing way), not type of purchase.
- If there are multiple accounts, one account who has RI can be used by another account in same organization.
- No money is lost at Org level.
Between on-demand and RI , there is a break-even point. Use the calculator to get some good ratio.
EFS Essentials ———————
- EFS is elastic file system.
- Can be shared by more than one EC2 instance.
- No need to worry about storage capacity.
- Petabyte scale FS. You pay by how many GB you are going to store/use.
- Only compatible with Ec2 instance that run Linux.
- EFSFilesync - local file system to EFS (tool provided by AWS).
- Can provide multiple mount points in multiple AZ.
- Burst network perf up to 100 MB/s
- Can encrypt at rest using AWS Key Magmt Service (KMS) - This is server side encryption.
- When to use?
- Big data and Analytics
- Media processing workflows
- Web servicing and content management