CloudFormation, apply Condition on DependsOn

后端 未结 3 1366

The task that I need to do is make CDN depend on a S3 bucket. But we want to make it use the existing bucket rather than creating a new one.

Here is the sample code

3条回答
  •  遥遥无期
    2020-12-24 14:08

    In your template you do not need to add the DependsOn attribute to your MyStaticDistribution resource as you already have a reference to the StaticBucket resource.

    This is documented in the Specifying Dependencies section of the Optimize AWS CloudFormation Templates blog post: https://aws.amazon.com/blogs/devops/optimize-aws-cloudformation-templates/

    When you need CloudFormation to wait to provision one resource until another one has been provisioned, you can use the DependsOn attribute.

    You can also introduce references between elements by using either the { "Ref": "MyResource" } or the { "Fn::GetAtt" : [ "MyResource" , "MyAttribute" ] } functions. When you use one of these functions, CloudFormation behaves as if you’ve added a DependsOn attribute to the resource.

提交回复
热议问题