2

Trying to format my yaml to download a script in S3 bucket to run in SSM.

I've tried many different formats, but all examples seem to be JSON formatted

- action: aws:downloadContent
  name: downloadContent
  inputs:
    sourceType: "S3"
    sourceInfo: 
      path: https://bucket-name.s3.amazonaws.com/scripts/script.ps1
    destinationPath: "C:\\Windows\\Temp"

Fails with the following message:

standardError": "invalid format in plugin properties map[destinationPath:C:\\Windows\\Temp sourceInfo:map[path:https://bucket-name.s3.amazonaws.com/scripts/script.ps1] sourceType:S3]; \nerror json: cannot unmarshal object into Go struct field DownloadContentPlugin.sourceInfo of type string"
mbspark
  • 534
  • 3
  • 18

2 Answers2

4

This is what ended up working for me:

    - action: aws:downloadContent
      name: downloadContent
      inputs:
        sourceType: S3
        sourceInfo: "{\"path\":\"https://bucket-name.s3.amazonaws.com/scripts/script.ps1\"}"
      destinationPath: "C:\\Windows\\Temp"

I needed that exact JSON syntax embedded in the YAML.

mbspark
  • 534
  • 3
  • 18
0

Posting JSON example as well, as we struggled to find examples in json that worked. Hoping this will help someone in the future.

Our error was related to "sourceInfo" key:

> invalid format in plugin properties map[destinationPath:C:\PATHONTARGETSYSTEM sourceInfo:map[path:https://S3BUCKETNAME.s3.amazonaws.com/SCRIPTNAME.ps1] sourceType:S3]; error json: cannot unmarshal object into Go struct field DownloadContentPlugin.sourceInfo of type string

Solution was ultimately the wrong S3 url format + the wrong json formatting. Should look like so:

"sourceInfo": "{\"path\": \"https://s3.amazonaws.com/S3BUCKETNAME/SCRIPTNAME.ps1\"}",