💾 Archived View for cfdocs.wetterberg.nu › aws-attribute-metadata.gemini captured on 2024-05-10 at 12:43:42. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Metadata attribute

Search

The Metadata attribute enables you to associate structured data with a resource. By adding a Metadata attribute to a resource, you can add data in JSON or YAML to the resource declaration. In addition, you can use intrinsic functions (such as GetAtt and Ref), parameters, and pseudo parameters within the Metadata attribute to add those interpreted values.

GetAtt

Ref

AWS CloudFormation does not validate the syntax within the Metadata attribute.

CloudFormation does not redact or obfuscate any information you include in the Metadata attribute. We strongly recommend you do not use this section to store sensitive information, such as passwords or secrets.

You can retrieve this data using the AWS command https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-stack-resource.html or the DescribeStackResource action.

https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-stack-resource.html

DescribeStackResource action

Example

The following template contains an Amazon S3 bucket resource with a Metadata attribute.

JSON

 1. {
 2.    "AWSTemplateFormatVersion" : "2010-09-09",
 3.    "Resources" : {
 4.       "MyS3Bucket" : {
 5.          "Type" : "AWS::S3::Bucket",
 6.          "Metadata" : { 
 7.             "Object1" : "Location1",  
 8.             "Object2" : "Location2" 
 9.          }
10.       }
11.    }
12. }

YAML

1. AWSTemplateFormatVersion: '2010-09-09'
2. Resources:
3.   MyS3Bucket:
4.     Type: AWS::S3::Bucket
5.     Metadata:
6.       Object1: Location1
7.       Object2: Location2