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
enthuguyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shalom CarmelCTOCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
enthuguyAuthor Commented:
Thanks a lot shalomc, that was really helpful
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.