Skip to content

AWS EC2 Instance

Shailesh Gupta edited this page Aug 10, 2024 · 2 revisions

Point to learn for AWS EC2 Instance

1. Launching an Instance

  • Choose AMI: Select an Amazon Machine Image (AMI) that contains the operating system and software you need.
  • Choose Instance Type: Select the instance type based on CPU, memory, and storage requirements.
  • Configure Instance: Set network, subnet, IAM role, and other settings.
  • Add Storage: Attach additional EBS volumes if needed.
  • Add Tags: Tag your instance for easier identification.
  • Configure Security Group: Define firewall rules for inbound and outbound traffic.
  • Review and Launch: Review your settings and launch the instance.

2. Connecting to an Instance

  • SSH (Linux): Use an SSH client to connect to your instance.
  • RDP (Windows): Use Remote Desktop Protocol (RDP) to connect to a Windows instance.

3. Managing Instances

  • Start/Stop Instances: Power on or off your instances as needed.
  • Reboot Instances: Restart your instance.
  • Terminate Instances: Permanently delete your instance and associated resources.

4. Monitoring Instances

  • Check Instance Status: Monitor the health and status of your instances.
  • View Logs: Access and analyze instance logs via CloudWatch Logs.
  • Set Alarms: Create CloudWatch Alarms to monitor performance metrics.

5. Scaling

  • Create AMIs: Create Amazon Machine Images for backup or scaling.
  • Set Up Auto Scaling: Configure Auto Scaling groups to automatically adjust the number of instances based on demand.

6. Security Management

  • Update Security Groups: Modify firewall rules to control access.
  • Modify Key Pairs: Manage SSH key pairs for secure access.
  • Enable Encryption: Use EBS encryption for data at rest.

7. Backup and Recovery

  • Create Snapshots: Take snapshots of EBS volumes for backup and recovery.
  • Restore from Snapshot: Use snapshots to create new volumes or recover data.

8. Networking

  • Associate Elastic IP: Allocate and associate Elastic IP addresses for static public IPs.
  • Modify Network Interface: Update network interface settings such as IP addresses and security groups.

9. Cost Management

  • Monitor Costs: Use AWS Cost Explorer and Budgets to track and manage EC2 costs.
  • Right-Size Instances: Adjust instance types based on performance and cost considerations.

10. Instance Configuration

  • Change Instance Type: Modify the instance type to adjust resources.
  • Resize Volumes: Increase or decrease EBS volume size.
  • Modify Instance Attributes: Change attributes such as IAM roles or instance tenancy.

11. Troubleshooting

  • Check System Logs: View instance system logs for errors and troubleshooting.
  • Network Diagnostics: Use tools like ping, traceroute, and netstat to diagnose network issues.

12. Tagging and Organization

  • Add/Edit Tags: Manage tags to organize and categorize instances.
  • Use Resource Groups: Create resource groups for managing multiple instances.

13. Instance Metadata

  • Access Metadata: Use instance metadata to retrieve information about the instance, such as instance ID, AMI ID, and instance type.

14. Migration Actions (Region to Region)

  • Create an AMI of the Instance: Create an Amazon Machine Image (AMI) of the instance in the source region.
  • Copy AMI to Target Region: Use the EC2 console or CLI to copy the AMI to the desired target region.
  • Launch Instance from Copied AMI: In the target region, launch a new instance from the copied AMI.
  • Update DNS Records: If the instance is associated with any DNS records, update them to point to the new instance in the target region.
  • Transfer Elastic IPs: Reassign any Elastic IP addresses if used, as they are region-specific.
  • Reconfigure Security Groups: Adjust security group settings in the target region to match those from the source region.
  • Test the New Instance: Ensure that the instance in the target region is working as expected, including applications and network connectivity.
  • Decommission Old Instance: Once you have validated the new instance, terminate the old instance in the source region if no longer needed.

Clone this wiki locally