在起草这个问题时,我开始研究 Fn:: 方法
(来源:https ://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.html )
我有个主意:
字符串列表是:"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"
它有效!下面是cloudformation模板:
SSM Parameter Store
:
"SSMTestBucketName": {
"Type": "AWS::SSM::Parameter",
"Properties": {
"Name": "StringList_Test_Bucket_Name",
"Type": "StringList",
"Value": "test-ssm-stringlist-bucket, https://www.requesturl.com"
}
}
S3 Bucket
:
"S3TestBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": {
"Fn::Select": [
"0",
{
"Fn::Split": [
",",
{
"Fn::GetAtt": [
"SSMTestBucketName",
"Value"
]
}
]
}
]
},
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}
]
},
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": true,
"BlockPublicPolicy": true,
"IgnorePublicAcls": true,
"RestrictPublicBuckets": true
},
"LifecycleConfiguration": {
"Rules": [
{
"Status": "Enabled",
"Transitions": [
{
"TransitionInDays": "30",
"StorageClass": "STANDARD_IA"
}
]
}
]
}
}
}