AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

cfn-get-metadata

Description

You can use the cfn-get-metadata helper script to fetch a metadata block from CloudFormation and print it to standard out. You can also print a sub-tree of the metadata block if the you specify a key. However, only top-level keys are supported.

Note

cfn-get-metadata does not require credentials, so you do not need to use the --access-key, --secret-key, or --credential-file options.

Syntax

cfn-get-metadata --access-key access.key \
                 --secret-key secret.key \
                 --credential-file|f credential.file \
                 --key|k key \
                 --stack|-s stack.name.or.id \
                 --resource|-r logical.resource.id \
                 --url|-u service.url \
                 --region region 

Options

NameDescriptionRequired

-k, --key

For a key-value pair, returns the name of the key for the value that you specified.

Type: String

Example: For { "SampleKey1" : "Key1", "SampleKey2" : "Key2" }, cfn-get-metadata -k Key2 returns SampleKey2.

No

-s, --stack

Name of the Stack.

Type: String

Default: None

Example: -s { "Ref" : "AWS::StackName" },

Yes

-r, --resource

The logical resource ID of the resource that contains the metadata.

Type: String

Example: -r WebServerHost

Yes

--region

The region to derive the CloudFormation URL from.

Type: String

Default: None

Example: --region ", { "Ref" : "AWS::Region" },

No

--access-key

AWS Access Key for an account with permission to call DescribeStackResource on CloudFormation.

Type: String

Condition: The credential file parameter supersedes this parameter.

Conditional

--secret-key

AWS Secret Key that corresponds to the specified AWS Access Key.

Type: String

Condition: The credential file parameter supersedes this parameter.

Conditional

-f, --credential-file

A file that contains both a secret key and an access key.

Type: String

Condition: The credential file parameter supersedes the --access-key and --secret-key parameters.

Conditional