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!

demandé il y a 8 mois366 vues
1 réponse
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
EXPERT
Mike_L
répondu il y a 8 mois
profile pictureAWS
EXPERT
vérifié il y a 8 mois
  • I want to use the input parameters in my AWS::SSM::Association command.

  • updated. Can test?

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions