CLI Commands
CLI Commands
EC2 instances:
1. Describe Instances
List all EC2 instances or get details about a specific instance.
bash
aws ec2 describe-instances
aws ec2 describe-instances --instance-ids <instance-id>
2. Launch an EC2 Instance
Launch an instance with a specific AMI ID, instance type, key pair, and security
group.
bash
aws ec2 run-instances --image-id <ami-id> --instance-type <instance-type> \
--key-name <key-pair-name> --security-group-ids <sg-id> --subnet-id <subnet-
id>
3. Stop an EC2 Instance
Stop a running instance.
bash
aws ec2 stop-instances --instance-ids <instance-id>
4. Start an EC2 Instance
Start a stopped instance.
bash
aws ec2 start-instances --instance-ids <instance-id>
5. Reboot an EC2 Instance
Reboot an instance.
bash