Let's assume I have a parameter in the SSM ParameterStore. The parameter has a StringList as value and describes a service, such as (bucket_name, request_url)
"serviceA" = "bucket_name_A, https://www.request.com/A"
Now, in CloudFormation I want to define the name of my bucket from this stringlist.
"S3FTSE100Intraday1min": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": {
"Fn::GetAtt": [
"My_SSM_ParameterStore_Logical_ID",
"Value"
]
},
...
But obviously this will return the full stringlist, not just bucket_name_A
How can I access one of the parameters in the stringlist to be used in the CloudFormation template?
Whilst drafting this question I started looking into the Fn:: methods
(source: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.html)
and I got an idea:
The stringlist is:
"bucket_name_A, https://www.request.com/A"
Fn::GetAtt
=>"bucket_name_A, https://www.request.com/A"
Fn::Split
=>["bucket_name_A", "https://www.request.com/A"]
Fn::Select
=>"bucket_name_A"
and it works! Here below is the cloudformation template:
SSM Parameter Store
:S3 Bucket
: