【发布时间】:2019-12-17 02:38:04
【问题描述】:
我有一个 CloudFormation 模板,可以创建一个 AWS::Events::Rule 和一个 AWS::SSM::Document。我需要为SSM::Rule 提供Targets 的列表,但每个目标都需要一个ARN:
mySSMDocument:
Type: AWS::SSM::Document
Properties:
DocumentType: 'Command'
Content:
schemaVersion: '2.2'
description: "Code that will be run on EC2"
mainSteps:
- action: "aws:runShellScript"
name: runShellScript
inputs:
runCommand:
- 'Some command to execute'
myEventRule:
Type: AWS::Events::Rule
Properties:
Description: "A description for the Rule."
EventPattern:
source:
- "aws.autoscaling"
detail-type:
- "EC2 Instance-terminate Lifecycle Action"
detail:
AutoScalingGroupName:
- !Ref 'someAutoScalingGroupInThisTemplate'
RoleArn: 'some role ARN'
State: "ENABLED"
Targets:
- Id: "some-unique-id"
Arn: <-- This is the value that I need to fill in.
RunCommandParameters:
RunCommandTargets:
- Key: "tag: Name"
Values:
- 'The name of the EC2 machine'
我认为我需要将<-- This is the value that I need to fill in. 替换为mySSMDocument 的ARN,但我看不到任何从模板本身中检索此值的方法。 The documentation 没有在SSM::Document 上指定任何允许获取ARN 的GetAtt 功能。有谁知道如何解决这个问题?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation ssm