sourceInfo
需要一个字符串列表。请务必转义字符串中的任何引号。
代替:
'{"sourceType":["S3"],"sourceInfo":["{"path":\"https://s3-eu-west-1.amazonaws.com/xxx/private/xxx.ps1\"}"],"commandLine":["xxx.ps1"]}'
用这个:
'{"sourceType":["S3"],"sourceInfo":["{\"path\":\"https://s3-eu-west-1.amazonaws.com/xxx/private/xxx.ps1\"}"],"commandLine":["xxx.ps1"]}'
在 Mac 上对我来说效果很好:
$ aws ssm create-association --name AWS-RunRemoteScript --targets Key=instanceids,Values=i-03710c82b70551c32 --parameters '{"sourceType":["S3"],"sourceInfo":["{\"path\":\"https://s3-eu-west-1.amazonaws.com/xxx/private/xxx.ps1\"}"],"commandLine":["xxx.ps1"]}' --schedule-expression "cron(0 0 2 ? * SUN *)"
{
"AssociationDescription": {
"Name": "AWS-RunRemoteScript",
"AssociationVersion": "1",
"Date": 1551432508.365,
"LastUpdateAssociationDate": 1551432508.365,
"Overview": {
"Status": "Pending",
"DetailedStatus": "Creating"
},
"DocumentVersion": "$DEFAULT",
"Parameters": {
"commandLine": [
"xxx.ps1"
],
"sourceInfo": [
"{\"path\":\"https://s3-eu-west-1.amazonaws.com/xxx/private/xxx.ps1\"}"
],
"sourceType": [
"S3"
]
},
"AssociationId": "5de73031-a390-4e7f-8b99-8064584e84cb",
"Targets": [
{
"Key": "instanceids",
"Values": [
"i-03710c82b70551c32"
]
}
],
"ScheduleExpression": "cron(0 0 2 ? * SUN *)"
}
}