Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Cloud/Start EC2 AMI from AWS CLI

May 24, 2017

Start EC2 AMI from AWS CLI

Amazon Web Services has an API via a CLI (command line interface) which give users the ability to manage servers from a remote host. The AWS CLI must be installed and authenticated to AWS on the host computer. Once a user is logged in to AWS, they can perform certain management tasks such as starting and stopping EC2 instances.

How to start EC2 instance from AWS CLI

Requires an image id, instance count, instance type, key and security group.

aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type c4.2xlarge --key-name your-key  —security-group-ids sg-xxxxxxxx

aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type c4.2xlarge --key-name your-key —security-group-ids sg-xxxxxxxx

How to Associate an Elastic IP Address to an Instance

Requires an instance id and Elastic IP address.

aws ec2 associate-address --instance-id i-xxxxxxxxxxxxxxxx --public-ip xxx.xxx.xxx.xxx

aws ec2 associate-address --instance-id i-xxxxxxxxxxxxxxxx --public-ip xxx.xxx.xxx.xxx

How to Terminate an Instance

Requires an instance id(s).

aws ec2 terminate-instances --instance-ids i-xxxxxxxxxxxxxxxx

aws ec2 terminate-instances --instance-ids i-xxxxxxxxxxxxxxxx

Filed Under: Cloud Tagged With: aws, cli, ec2

Have content delivered to your mail. Subscribe below.

About Me

I'm Ulysses, a Cloud Engineer at Cardinal Health based in Columbus, Ohio. I’m a certified AWS Solutions Architect. This website is my way of documenting the things I have learned in the Cloud. When off the grid, I enjoy riding my electric skateboard. I have surfed, snowboarded and played the saxophone in the past. I hope you will find this site helpful. It's powered by WordPress and hosted in AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021