ahkam
ahkam

Reputation: 767

How to get the ssm parameter to a yaml file?

I have a yaml cloud formation file which requires a variable stored in ssm parameter. The yaml file is a CFT template. Below is the sample code,

AWSTemplateFormatVersion: 2010-09-09
Description: 'Fully Automated OT Archival Data Migration'
Parameters:
 Environment:
  Description: 'Stage type (for Tags)'
  Type: String
  Default: dev

Resources:
S3Bucket:
 Type: 'AWS::S3::Bucket'
 Properties:
  BucketName: '{{resolve:ssm:/opentext/config/automated-ot-archival-data-migration/migration.bucket.name:1}}-${Environment}'

When I upload the code to cloudformation in AWS console, I results with an error. I'm wondering whether the ssm param reference is correct or not.

Please let me know if you find any issues here.

Thanks

Upvotes: 2

Views: 1545

Answers (1)

Robert Kossendey
Robert Kossendey

Reputation: 6998

You are missing the !Sub function for your {Environment} variable.

BucketName: !Sub '{{resolve:ssm:/opentext/config/automated-ot-archival-data-migration/migration.bucket.name:1}}-${Environment}'

Upvotes: 5

Related Questions