cfn-get-metadata
You can use the cfn-get-metadata
helper script to fetch a metadata block
from CloudFormation and print it to standard output. You can also print a sub-tree of the
metadata block if you specify a key. However, only top-level keys are supported.
Syntax
cfn-get-metadata --access-key
access.key
\ --secret-keysecret.key
\ --credential-file|fcredential.file
\ --key|kkey
\ --stack|-sstack.name.or.id
\ --resource|-rlogical.resource.id
\ --roleIAM.role.name
\ --url|-uservice.url
\ --regionregion
Note
cfn-get-metadata
doesn't require credentials, so you don't need to
use the --access-key
, --secret-key
, --role
, or
--credential-file
options. However, if no credentials are specified,
CloudFormation checks for stack membership and limits the scope of the call to the stack
that the instance belongs to. For more information, see Permissions for helper
scripts.
Options
Name | Description | Required |
---|---|---|
|
For a key-value pair, returns the name of the key for the value that you specified. Type: String Example: For |
No |
|
Name of the Stack. Type: String Default: None Example: |
Yes |
|
The logical resource ID of the resource that contains the metadata. Type: String Example: |
Yes |
|
The name of an IAM role that's associated with the instance. Type: String Condition: The credential file parameter supersedes this parameter. |
No |
|
The region to derive the CloudFormation URL from. Type: String Default: None Example: |
No |
|
AWS Access Key for an account with permission to call DescribeStackResource on CloudFormation. Type: String Condition: The credential file parameter supersedes this parameter. |
Conditional |
|
AWS Secret Key that corresponds to the specified AWS Access Key. Type: String Condition: The credential file parameter supersedes this parameter. |
Conditional |
|
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 |