AWS EC2 Instance Cheat Sheet

Greetings! 👋 I'm Priyadarshi Ranjan, a dedicated DevOps Engineer embarking on an enriching journey. Join me as I delve into the dynamic realms of cloud computing and DevOps through insightful blogs and updates. 🛠️ My focus? Harnessing AWS services, optimizing CI/CD pipelines, and mastering infrastructure as code. Whether you're peers, interns, or curious learners, let's thrive together in the vibrant DevOps ecosystem. 🌐 Connect with me for engaging discussions, shared insights, and mutual growth opportunities. Let's embrace the learning curve and excel in the dynamic realm of AWS and DevOps technology!
Amazon EC2 (Elastic Compute Cloud): A service that provides scalable, secure, and customizable virtual servers (instances) in the cloud.
1. Instance Types:
General Purpose: Balanced compute, memory, and networking (e.g., t2.micro, t3.medium).
Compute Optimized: Best for compute-intensive applications (e.g., c5.large).
Memory Optimized: Ideal for memory-heavy applications (e.g., r5.large).
Storage Optimized: Optimized for high-performance storage (e.g., i3.large).
2. Pricing Models:
On-Demand: Pay per hour or second without long-term commitments. Best for short-term or unpredictable workloads.
Reserved Instances: Pre-pay for a 1 or 3-year term and get significant discounts. Ideal for steady, long-term workloads.
Spot Instances: Bid for unused capacity at lower prices but can be interrupted by AWS when needed. Great for non-critical tasks.
Savings Plans: Flexible pricing based on consistent usage with discounts.
3. Key Features:
Elastic IP: Static IP address you can move across instances.
Auto Scaling: Automatically adjusts instance capacity based on traffic.
Security Groups: Acts like a firewall, controlling traffic to and from the instance.
Key Pairs: SSH keys for secure access to your instance.
4. Storage Options:
EBS (Elastic Block Store): Persistent storage that can be attached/detached from instances. EBS volumes can be backed up via snapshots.
Instance Store: Temporary storage that’s lost when the instance stops or terminates.
5. Real-Life Example:
If you’re hosting a new web application, you could start with a t2.micro instance (free tier), set up your app, and use Security Groups to allow HTTP/HTTPS traffic. As traffic grows, scale up to a larger instance or use Auto Scaling to automatically add resources during peak times (like holiday sales). For cost savings, you can switch to Spot Instances for non-critical workloads.
6. Commands:
Launch an EC2 instance:
aws ec2 run-instances --image-id <AMI-ID> --instance-type t2.micro --key-name MyKeyPair --security-group-ids <SG-ID>Stop an instance:
aws ec2 stop-instances --instance-ids <Instance-ID>Terminate an instance:
aws ec2 terminate-instances --instance-ids <Instance-ID>
Conclusion:
AWS EC2 allows you to scale your computing needs with ease. It provides flexibility with various instance types and pricing models, making it a powerful solution for anything from small projects to large-scale enterprise systems.
Connect and Follow Me on Socials Network




