amazon web services - How to print the value from a StringList parameter in an SSM Automation Document - Stack Overflow

I have a StringList parameter in a Runbook, and I want to assign it to a variable of type String. What

I have a StringList parameter in a Runbook, and I want to assign it to a variable of type String. What is the best way to do this? I have tried many ways from the web, but all have failed. My problem is that in the SNS notification, the instanceIds do not come up; just the variable name gets printed.

In SNS Notifiation it looks like: Message from requester: Stopping instance(s): {{ instanceId | join(', ') }}

I expect it to show the value of the parameter: Stopping instance(s): i-0d7193149e634d705

schemaVersion: '0.3'
description: Stops EC2 instance on approval
assumeRole: arn:aws:iam::123456789:role/ssm-document-role
parameters:
  instanceId:
    type: StringList
    description: The ID of the EC2 instance to stop
  ApproverSnsTopicArn:
    type: String
    description: Notification SNS ARN
    default: arn:aws:sns:us-east-1:123456789:automation-approval-topic
  Message:
    type: String
    description: Message for Approver
  Approver:
    type: String
    description: Approver ARN
    default: arn:aws:iam::123456789:user/ssm-approver
mainSteps:
  - name: Approve
    action: aws:approve
    nextStep: ChangeInstanceState
    isEnd: false
    inputs:
      NotificationArn: '{{ ApproverSnsTopicArn }}'
      Message: 'Stopping instance(s): {{ instanceId | join(', ') }}'
      Approvers:
        - arn:aws:iam::123456789:user/ssm-approver
  - name: ChangeInstanceState
    action: aws:changeInstanceState
    isEnd: true
    inputs:
      DesiredState: stopped
      InstanceIds: '{{ instanceId }}'

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744205099a4563063.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信