How to reference input parameters in cloudformation template inside 'AWS::SSM::Association' command?

0

Hi there, I have asked this similar question earlier and that got resolved. But still I am not sure on how to achieve this.

I am stuck with the following problem:- I am creating asking an input parameter in my template like this:-

 Name:
    Type: String
    Description: Enter your name
Location:
    Type: String
    Description: Enter your country

Now, I want to get the value of this parameter in my AWS::SSM::Association resource:-

RunCommandAssociation1:
    Type: 'AWS::SSM::Association'
    Properties:
      Name: 'AWS-RunShellScript'
      Targets:
        - Key: InstanceIds
          Values:
            - !Ref Instance1
      Parameters:
        commands:
            name=${Name}
            location=${Location}

The above does not seems to be working. Can someone please help me how can I get multiple such parameters referenced in my AWS::SSM::Association commands.

Thanks in advance!

質問済み 8ヶ月前366ビュー
1回答
1

Use either !Ref or !Sub as part of a string, example below for SSM::Association

Parameters:
 MyName:
    Type: String
    Description: Enter your name
 MyLocation:
    Type: String
    Description: Enter your country

Resources:
    Type: AWS::SSM::Association
    Properties:
      Parameters:
        commands:
        - !Sub "name=${MyName}"
        - !Sub "location=${MyLocation}"
AWS
エキスパート
Mike_L
回答済み 8ヶ月前
profile pictureAWS
エキスパート
レビュー済み 8ヶ月前
  • I want to use the input parameters in my AWS::SSM::Association command.

  • updated. Can test?

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ