如何在AWS数据管道中的Shell脚本中读取ssm参数?

问题描述

我正在aws中建立数据管道。并计划使用“使用ShellCommandActivity入门”模板运行Shell脚本。如何将存储在ssm参数中的凭据作为参数传递给此脚本。

解决方法

我尚未验证,但据我所知ShellCommandActivityShellScriptConfig类似。根据为这些命令提供的示例,我认为您可以按以下方式传递ssm参数名称:

{
  "id" : "CreateDirectory","type" : "ShellCommandActivity","command" : "your-script.sh <name-of-your-parameter>"
}

{
  "id" : "CreateDirectory","scriptUri" : "s3://my-bucket/example.sh","scriptArgument" : ["<name-of-your-parameter>"]
}

,在example.sh中,您将使用$1来引用传递的参数的值。