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!

gefragt vor 8 Monaten366 Aufrufe
1 Antwort
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
EXPERTE
Mike_L
beantwortet vor 8 Monaten
profile pictureAWS
EXPERTE
überprüft vor 8 Monaten
  • I want to use the input parameters in my AWS::SSM::Association command.

  • updated. Can test?

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen