Modify EC2 Instance Type via AWS CLI
Change EC2 Instance Type Using AWS CLI Commands

Infosec Poet and CAP-certified DevOps/SecOps Engineer, passionate about security, creativity, and continuous learning.
Tasks
Change the instance type from
t2.microtot2.nanofor thenautilus-ec2instance usingaws-clionly.Ensure the
nautilus-ec2instance is in therunningstate after the change.
Steps
Get the instance ID and Stop the
nautilus-ec2instance:aws ec2 describe-instances --filters "Name=tag:Name,Values=nautilus-ec2" --query "Reservations[*].Instances[*].InstanceId" --output text
- i-0a089a6cf430546c4
aws ec2 stop-instances --instance-ids i-0a089a6cf430546c4

- Wait until the instance is stopped:
aws ec2 wait instance-stopped --instance-ids i-0a089a6cf430546c4
- Change the instance type to
t2.nano:
aws ec2 modify-instance-attribute --instance-id i-0a089a6cf430546c4 --instance-type "{\"Value\": \"t2.nano\"}"
- Start the
nautilus-ec2instance:
aws ec2 start-instances --instance-ids i-0a089a6cf430546c4
Ensure the instance is in the
runningstate:aws ec2 wait instance-running --instance-ids i-0a089a6cf430546c4Check the instance type now.
aws ec2 describe-instances --instance-ids i-0a089a6cf430546c4 --query "Reservations[*].Instances[*].InstanceType" --output text

#aws #cloudcomputing #happylearning





