BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News AWS Makes CloudFormation Stack Creation up to 40% Faster

AWS Makes CloudFormation Stack Creation up to 40% Faster

This item in japanese

Amazon optimized the AWS CloudFormation stack creation process to make it faster and achieved significant improvements. The company split the resource creation process into two phases (creation and stabilization), which allows for creating other resources in the stack earlier. The change is available in all regions and doesn’t require any user action.

Previously the stack provisioning process of AWS CloudFormation combined all tasks involved in resource provisioning into a single step. For each resource in the stack, CloudFormation would emit CREATE_IN_PROGRESS and CREATE_COMPLETE events at the start and end of the provisioning process. Internally, however, CloudFormation would request resource creation from the relevant service and then wait for the resource to be ready for use (created and stable).

Bhavani Kanneganti, principal engineer at AWS Support, and Idriss Laouali Abdou, senior product manager at AWS, explain the need for resource stabilization:

When provisioning AWS resources, CloudFormation makes the necessary API calls to the underlying services to create the resources. After creation, CloudFormation then performs eventual consistency checks to ensure the resources are ready to process the intended traffic, a process known as resource stabilization. [...] Resource stabilization is not unique to CloudFormation and must be handled to some degree by all IaC tools.

The original approach ensured that all dependent resources were ready for use before creating any new resource, but always waiting for the stabilization introduced delays and made stack creation longer than necessary in most cases. The team opted to separate resource creation (requesting new resources from AWS services) and resource stabilization (waiting for the resource to be ready for use) into distinct phases and optimistically start creating further resources in the stack once the creation phase was completed.

The new optimized resource provisioning strategy additionally has a retry capability. If resource creation fails, it is retried once the stabilization phase of the dependent resource is completed.

The New Stack Provisioning Strategy with Retry (Source: AWS DevOps Blog)

CloudFormation selects the appropriate provisioning strategy based on the type of dependency between resources. For implicit dependencies, where one resource depends on another using an intrinsic function (like Fn::GetAtt and Ref), the new strategy is used. For explicit dependencies (those with the DependsOn attribute), the previous strategy that includes resource stabilization is used to ensure the resource is ready.

With the changes, CloudFormation introduced a new CONFIGURATION_COMPLETE event, emitted once the creation phase of resource provisioning completes. The event is used internally to orchestrate the stack provisioning but can also be used directly by clients to speed up the creation of further resources or stacks if resource consistency checks are unnecessary, for example, when validating pre-production stack configurations.

New CONFIGURATION_COMPLETE Events in Stack Creation Log (Source: AWS DevOps Blog)

About the Author

Rate this Article

Adoption
Style

BT