• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 70
  • Last Modified:

AWS CLI instance status and process check

HI Experts,

Have an AWS Instance and I would like to manage them using AWS CLI.

So I was able to install, configure, and setup aws cli on linux and able to stop/start a particular instance using CLI.

my request here is
Since I have this as part of a CDCI Jenkins Pipeline...When starting an instance, would like to
  1. Ensure instance is fully up and running.
  2. Required services are up and running as well (e.g. jenkins, docker, etc)
  3. Before I trigger downstream job.

Could you pls help what is the best way to achieve this. I'm not restricted to AWS CLI, we can also try boto3 as well if we have more control over there.

thanks in advance
0
enthuguy
Asked:
enthuguy
1 Solution
 
shalomcCTOCommented:
There are several cli commands you can use get information about your instances. Afaik boto3 does not have any hidden capabilities, except of course that you are dealing with code and not shell scripts.

To monitor the instance status:
aws ec2 describe-instance-status --instance-ids <your_instance_list>

Open in new window


To wait until the instance reaches specific EC2 status
aws ec2 wait instance-status-ok  --instance-ids <your_instance_list>

Open in new window


To get the console output and be able to parse it for important messages:
aws ec2 get-console-output  --instance-id  <your_instance>

Open in new window


You could also use the AWS Systems Manager (ssm) to configure your servers and the application infrastructure. SSM has both inventory management (which servers I have and what are they running), and actions.
1
 
enthuguyAuthor Commented:
Thanks a lot shalomc, that was really helpful
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Increase Security & Decrease Risk with NSPM Tools

Analyst firm, Enterprise Management Associates (EMA) reveals significant benefits to enterprises when using Network Security Policy Management (NSPM) solutions, while organizations without, experienced issues including non standard security policies and failed cloud migrations

Tackle projects and never again get stuck behind a technical roadblock.
Join Now