I have a bashscript present in S3 bucket.i need to run that bashscript in my EC2 instance using python.
I tried using ssm but it is not working.
params={
'sourceType': ['S3'],
'path': ['https://test-bucket.s3.us-west-2.amazonaws.com/testscript.sh'],
'commands' : ['sh testscript.sh'],
}
testCommand = ssm_client.send_command( InstanceIds=[ InstanceId], DocumentName='AWS-RunShellScript', Parameters= params)
Can someone please help me solving this issue
Try by the following method, add the below in your command document
---
schemaVersion: "2.2"
description: "Command Document Example JSON Template"
parameters:
Message:
type: "String"
description: "Run command through S3"
default: "Run command through S3"
mainSteps:
- action: "aws:runShellScript"
name: "s3commandexecution"
inputs:
runCommand:
- curl -L https://test-bucket.s3.us-west-2.amazonaws.com/testscript.sh > testscript.sh
- ./testscript.sh
Then run your command through python boto3
testCommand = ssm_client.send_command( InstanceIds=[ InstanceId], DocumentName='AWS-RunShellScript')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.