Jump to content

AWS CloudFormation

From Wikipedia, the free encyclopedia
AWS CloudFormation
Developer(s)Amazon Web Services
Initial releaseFebruary 25, 2011; 13 years ago (2011-02-25)
Operating systemCross-platform
PlatformAmazon Web Services
TypeInfrastructure as Code, Cloud computing
LicenseProprietary software
Websiteaws.amazon.com/cloudformation/

AWS CloudFormation is a service provided by Amazon Web Services (AWS) that enables users to model and manage infrastructure resources in an automated and secure manner.[1] Using CloudFormation, developers can define and provision AWS infrastructure resources using a JSON- or YAML-formatted infrastructure as code template.[2][3] The service was released on February 25, 2011.[4][5][6][7]

Overview

[edit]

AWS CloudFormation provides a way for users to model an entire AWS infrastructure in a text file, allowing for the infrastructure to be version-controlled, shared, and reused.[8] By using templates, users can create, update, and delete a collection of resources together as a single unit, known as a stack.[9]

Template anatomy

[edit]

A CloudFormation template consists of several sections, including Resources, Parameters, Mappings, Conditions, Outputs, and Metadata.[10] The most important section is the Resources section, which defines the AWS resources to be created or modified.

Resources

[edit]

Resources are the AWS components that are created, updated, or deleted when the CloudFormation stack is created, updated, or deleted. Examples of resources include Amazon EC2 instances, Amazon S3 buckets, and AWS Lambda functions.[11]

Parameters

[edit]

Parameters enable users to input custom values to a CloudFormation template, allowing for customization without modifying the template itself.[12] This makes templates more reusable and flexible to accommodate different environments and use cases.

Mappings

[edit]

Mappings define a set of key-value pairs that can be used to map input values to corresponding output values, making it possible to conditionally define properties and values based on the input parameters.[13] For example, mappings can be used to define different instance types and Amazon Machine Images (AMIs) for different environments.

Conditions

[edit]

Conditions enable users to define conditional statements within a CloudFormation template, allowing for the creation or modification of resources based on specific criteria.[14] This can be useful in cases where certain resources should only be created or modified under specific circumstances.

Outputs

[edit]

Outputs provide a way to export information about the created resources, making it possible to share this information between stacks or with external systems.[15] Outputs can be used to easily reference resources created by a stack in another stack, facilitating the integration of different AWS services.

Metadata

[edit]

Metadata is used to provide additional information about the template or resources within the template.[16] This can include documentation, licensing information, or other descriptive data.

Example CloudFormation template

[edit]

The following example demonstrates a simple AWS CloudFormation template in YAML format:[17]


---
AWSTemplateFormatVersion: '2010-09-09'
Description: A simple AWS CloudFormation template for an Amazon S3 bucket.
Parameters:
  BucketName:
    Description: The name of the Amazon S3 bucket.
    Type: String
Resources:
  S3Bucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: !Ref BucketName
Outputs:
  BucketARN:
    Description: The Amazon S3 bucket ARN.
    Value: !GetAtt S3Bucket.Arn

This template has the following sections:

AWSTemplateFormatVersion: Specifies the CloudFormation template version.

Description: Provides a brief description of the template.

Parameters: Defines input parameters for the template. In this example, the parameter is the Amazon S3 bucket's name.

Resources: Lists the AWS resources to be created. Here, it specifies the creation of an Amazon S3 bucket.

Outputs: Defines the values to be returned after the stack is created. In this case, it returns the Amazon Resource Name (ARN) of the created S3 bucket.

By using this template in AWS CloudFormation, a user can create an Amazon S3 bucket with a specified name, and the ARN of the created bucket will be returned as an output value.

AWS CloudFormation Drift Detection

[edit]

AWS CloudFormation Drift Detection is a feature that allows users to detect whether their stack resources have drifted from their expected template configurations.[18] Drift detection helps maintain the consistency of infrastructure resources and aids in troubleshooting when unexpected changes occur.

Key milestones

[edit]

2011: AWS CloudFormation was officially launched on February 25, 2011, providing users with a way to define and manage AWS infrastructure resources using a single text file.[19]

2016: Support for YAML formatted templates was introduced, in addition to the original JSON format, offering users more options when creating templates.[20]

2018: AWS CloudFormation Drift Detection was launched, allowing users to detect when their stack resources have drifted from their expected configurations. This feature helps users identify and address configuration discrepancies.[21]

2019: AWS CloudFormation Registry and CLI were introduced, enabling users to extend the service with third-party and custom resource types. This enhancement allows for more flexibility in managing resources beyond the native AWS offerings.[22]

See also

[edit]

References

[edit]
  1. ^ "AWS CloudFormation - Infrastructure as Code & AWS Resource Provisioning". Amazon Web Services, Inc. Retrieved 2023-03-19.
  2. ^ "AWS CloudFormation User Guide". Amazon Web Services, Inc. Retrieved 2023-03-19.
  3. ^ Br, John; Published, On (2020-01-11). "What is AWS CloudFormation?". TechRadar. Retrieved 2023-03-19.
  4. ^ Ricknäs, Mikael (2011-02-25). "Amazon aims to make it easier to build complex clouds". InfoWorld. Retrieved 2023-03-19.
  5. ^ Writer, CBR Staff (2011-02-28). "Amazon launches AWS CloudFormation". Tech Monitor. Retrieved 2023-03-19.
  6. ^ "Amazon AWS Launches CloudFormation". InfoQ. Retrieved 2023-03-19.
  7. ^ "Release history - AWS CloudFormation". docs.aws.amazon.com. Retrieved 2023-03-19.
  8. ^ "AWS CloudFormation Features". Amazon Web Services, Inc. Retrieved 2023-03-19.
  9. ^ "Working with Stacks - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  10. ^ "Template Anatomy - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  11. ^ "Resource and Property Types Reference - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  12. ^ "Parameters - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  13. ^ "Mappings - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  14. ^ "Conditions - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  15. ^ "Outputs - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  16. ^ "Metadata - AWS CloudFormation". Amazon Web Services, Inc. Retrieved 2023-03-19.
  17. ^ "Template Anatomy". Amazon Web Services, Inc. Retrieved 2023-03-19.
  18. ^ "New – Drift Detection for AWS CloudFormation Stack Resources". Amazon Web Services, Inc. Retrieved 2023-03-19.
  19. ^ "Introducing AWS CloudFormation". Amazon Web Services, Inc. 2011-02-25. Retrieved 2023-03-19.
  20. ^ Jeff Barr (2016-09-19). "AWS CloudFormation Update – YAML, Cross-Stack References, Simplified Substitution". Amazon Web Services, Inc. Retrieved 2023-03-19.
  21. ^ "New – CloudFormation Drift Detection | AWS News Blog". aws.amazon.com. 2018-11-13. Retrieved 2023-03-19.
  22. ^ "CloudFormation Update – CLI + Third-Party Resource Support + Registry | AWS News Blog". aws.amazon.com. 2019-11-18. Retrieved 2023-03-19.
[edit]