Hi@akhtar,
Boto represents an Amazon Web Services (AWS) SDK that is available for Python. It allows Python developers to design configuration, manage, and configure AWS services, including EC2 as well as S3. Boto provides an easy-to utilize, object-oriented API and also the ability to access low level AWS services. You can even check out the details from the AWS Course.
You can use the boto3 module to do this. Boto3 module has arguments named send_command. It helps you to run commands in EC2 instance.
ssm_client = boto3.client('ssm')
response = ssm_client.send_command(
InstanceIds=['i-03#####'],
DocumentName="AWS-RunShellScript",
Parameters={'commands': ['start ecs']}, )
command_id = response['Command']['CommandId']
output = ssm_client.get_command_invocation(
CommandId=command_id,
InstanceId='i-03######',
)
print(output)