I have the below python code inside Lambda function:
print("Executing shell script-")
response = ssm_client.send_command(
InstanceIds=ec2_instance,
DocumentName="AWS-RunShellScript",
Parameters={
"commands": [f"sh /bin/test/publishImage.sh -c {ecr} -r {ecr_repo} -r {region} -e {environment}"]
},
OutputS3BucketName="deploymentlogs",
OutputS3Region=region
)
print("Done - Executing shell script.")
and when executed Lambda returns immediately with Status Code 200 in just few seconds whereas the publishImage.sh script takes around 3 minutes to complete its execution.
I would want Lambda to return after publishImage.sh script completes it execution irrespective of success or failure.
How can I achieve this ? Please help.
Thanks