Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


AWS is a great platform for scripted control of your EC2 instances. See for information on command-line tools and SDKs for other languages, such as java, python, C++, and all the others needed for buzzword-compliance. Here is an example CLI script.


     # Note that these scripts rely on having 'StrictHostKeyChecking accept-new' in the ~/.ssh/config file.
     # For jq, a sort of sed for json data, see

     echo ""

     id=`aws ec2 describe-instances | jq --raw-output '.Reservations[0].Instances[0].InstanceId'`

     status=`aws ec2 describe-instances --instance-ids $id | jq --raw-output '.Reservations[0].Instances[0].State.Name'`

     if [ $status = "running" ]; then

         ip=`aws ec2 describe-instances --instance-ids $id | jq --raw-output '.Reservations[0].Instances[0].PublicIpAddress'`

         echo "instance-id: $id status: $status 'ubuntu@$ip'"

         echo "instance-id: $id status: $status"

     echo ""

     exit 0

Amazon Linux 2

Instructions for Amazon Linux 2 are TBD.