Systems Manager のオートメーションを使用してパラメータストアからパラメータを取得する方法を教えてください?

所要時間1分
0

AWS Systems Manager の機能であるオートメーションを使用してパラメータを取得する方法を知りたいと考えています。

解決策

オートメーションアクション aws: executeAwsApiGetParameter API とともに使用して、AWS Systems Manager の機能であるパラメータストアからパラメータ値を取得します。

例:

{
  "description": "Automation Document Example JSON Template",
  "schemaVersion": "0.3",
  "assumeRole": "{{ AutomationAssumeRole }}",
  "parameters": {
    "ParameterName": {
      "type": "String",
      "description": "Enter the Name of the String Parameter to retrieve its value"
    },
    "AutomationAssumeRole": {
      "type": "String",
      "description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf.",
      "default": ""
    }
  },
  "mainSteps": [
    {
      "name": "getparameter",
      "action": "aws:executeAwsApi",
      "inputs": {
        "Service": "ssm",
        "Api": "GetParameter",
        "Name": "{{ ParameterName }}"
      },
      "outputs": [
        {
          "Name": "Parameters",
          "Selector": "$.Parameter.Value",
          "Type": "String"
        }
      ]
    }
  ],
  "outputs": [
    "getparameter.Parameters"
  ]
}

SecureString パラメータを取得するには、WithDecryption を使用して値を true に設定します。

例:

"mainSteps": [
    {
      "name": "getparameter",
      "action": "aws:executeAwsApi",
      "inputs": {
        "Service": "ssm",
        "Api": "GetParameter",
        "Name": "{{ ParameterName }}",
        "WithDecryption": true
      },

詳細については、「Run Command コマンドによるパラメータの操作」を参照してください。

関連情報

AWS Systems Manager Parameter Store

データ要素とパラメータ

AWS:: SSM:: パラメータ

AWS公式
AWS公式更新しました 10ヶ月前
コメントはありません