CloudFormation Features: Part II
Explore advanced AWS CloudFormation features such as CreatePolicy and UpdatePolicy to control resource creation and updates. Learn how stack policies safeguard resources, manage multi-account deployments with StackSets, and import existing resources to CloudFormation. Understand the differences between CloudFormation and Elastic Beanstalk to efficiently automate and manage your AWS infrastructure.
CreatePolicy
The CreatePolicy attribute can be used with a resource to prevent its status from reaching the create complete state until AWS CloudFormation receives a certain number of signals from the resource. The CreatePolicy attribute is only supported by the following resource types:
AWS::AppStream::FleetAWS::AutoScaling::AutoScalingGroupAWS::EC2::InstanceAWS::CloudFormation::WaitCondition
In the following code, we have a resource, EducativeASG, with desired capacity 3. We’ve associated a creation policy with this ASG to ensure that CloudFormation receives three SUCCESS signals, one from each of the ASG instances.
UpdatePolicy
We can use UpdatePolicy to specify how CloudFormation should update a resource. The UpdatePolicy attribute is supported for the following resource types in CloudFormation:
AWS::AppStream::FleetAWS::AutoScaling::AutoScalingGroupAWS::ElastiCache::ReplicationGroupAWS::OpenSearchService::Domain