Starting EC2 instance with Linux services health check

  amazon-ec2, devops, lambda, linux, python

I am a beginner in DevOps and a noob at programming. I have been assigned a task to autostart a group of instances with a specific sequence. Checking the health of its Linux services before starting the next one.

I found an auto stop and start python script that can be run as a lambda function, but I am clueless about how can I start the instances sequentially and check the server services health.

I would really appreciate, if something can help me out or guide me on how can I do that.

Thank you

import boto3
region = 'region'
instances = ['instance id']
ec2 = boto3.client('ec2', region_name=region)


def lambda_handler(event, context):
    ec2.start_instances(InstanceIds=instances)
    print('started your instances: ' + str(instances))

Source: Python Questions

LEAVE A COMMENT