1
votes

In my CloudFormation template, I'm trying to create an S3 Bucket only if S3 doesn't already have a bucket that includes a certain keyword in it's name. For example, if my keyword is 'picture', I only want this S3 bucket to be created if no bucket in S3 contains the word 'picture' in its name.

    "Resources": {
        "myBucket": {
            "Condition" : "<NO_S3_BUCKET_WITH_'picture'_IN_ITS_NAME_IN_THIS_ACCOUNT>",
            "Type": "AWS::S3::Bucket",
            "Properties": {
                <SOME_PROPERTIES>
            }
        },
        <OTHER_RESOURCES>
    }

Is this possible? if so, can it be done with other AWS resources (CloudFront Distribution etc.)?

1
How did it go? Is is still unclear what you can't do what you want and what you should do?Marcin
I ended up taking another approach as developing a custom resource isn't worth it in this case. But I now understand that I can't do that logic in plain CloudFormation. Thanks!Abe Mused

1 Answers

0
votes

Is this possible?

Not with plain CloudFormation. You would have to develop a custom resource to do this.