Where/how 我要在 AWS SSM Automation 文档中定义 NotificationConfig 吗?

Where/how do I define a NotificationConfig in an AWS SSM Automation document?

假设我有一个如下所示的 SSM 文档,我想在 运行 因任何原因失败或未完成时得到提醒:

{
  "description": "Restores specified pg_dump backup to specified RDS/DB.",
  "mainSteps": [
    {
      "action": "aws:runCommand",
      "description": "Restores specified pg_dump backup to specified RDS/DB.",
      "inputs": {
        "DocumentName": "AWS-RunShellScript",
        "Parameters": {
          "commands": [
            "blahblahblah"
          ],
          "executionTimeout": "1800"
        },
        "Targets": [
          {
            "Key": "InstanceIds",
            "Values": [
              "i-xxxxxxxx"
            ]
          }
        ]
      },
      "name": "DBRestorer",
      "nextStep": "RunQueries"
    },

Terraform 文档告诉我 RunCommand 文档应该支持 NotificationConfig,我可以在其中传递我的 SNS 主题 ARN 并声明什么状态转换应该触发消息:https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_maintenance_window_task#notification_config

但是,我找不到任何实际包含在文档本身中使用通知配置的 Amazon 文档(不仅仅是维护 window,我已将其设置为自动化,因此它不会' window 级别不支持),所以我不确定它是否属于子参数,或者是否用驼峰式或破折号分隔来定义它。

试试这个

{
  "description": "Restores specified pg_dump backup to specified RDS/DB.",
  "mainSteps": [
    {
      "action": "aws:runCommand",
      "description": "Restores specified pg_dump backup to specified RDS/DB.",
      "inputs": {
        "DocumentName": "AWS-RunShellScript",
        "NotificationConfig": {
          "NotificationArn": "<<Replace this with a SNS Topic Arn>>",
          "NotificationEvents": ["All"],
          "NotificationType": "Invocation"
        },
        "ServiceRoleArn": "<<Replace this with an IAM role Arn that has access to SNS>>",
        "Parameters": {
          "commands": [
            "blahblahblah"
          ],
          "executionTimeout": "1800"
        },
        "Targets": [
          {
            "Key": "InstanceIds",
            "Values": [
              "i-xxxxxxxx"
            ]
          }
        ]
      },
      "name": "DBRestorer",
      "nextStep": "RunQueries"
    },
    ...
  ]
}

相关文档: