Chapter 29 · AWS Cloudformation
Subchapter 29.5
references/lookup-resource-properties.script.mdMarkdown6 KBView on GitHub
Deterministic procedure for looking up the authoritative schema for a CloudFormation resource type: property names, types, which are required vs. optional, valid enum values, and return values for !GetAtt. Use when authoring or modifying a template and you need to avoid guessing at property names.
AWS::Lambda::Function, AWS::S3::Bucket, AWS::DynamoDB::Table).properties (default) — all properties with typesrequired — only required propertiesreturn-values — what !Ref and !GetAtt returnproperty:<PropertyName> — deep-dive on a single property including nested sub-propertiesConstraints for parameter acquisition:
AWS::Lambda::Function)Check which lookup mechanism is available.
Constraints:
cfn-lint‘s bundled schema via cfn-lint --info) and ask whether to use the local fallback or abortDerive the authoritative CloudFormation documentation URL from the resource type.
Constraints:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-<service>-<resource>.htmlAWS::Lambda::Function → aws-resource-lambda-function.htmlAWS::S3::Bucket → aws-resource-s3-bucket.htmlAWS::DynamoDB::Table → aws-resource-dynamodb-table.htmlaws-properties- instead of aws-resource- (e.g., aws-properties-ec2-securitygroup.html). If the first URL returns a 404, You MUST try the aws-properties- variantRetrieve the documentation and extract the relevant sections.
Constraints:
focus parameter:
!Ref and !GetAtt attributes<Name>: the sub-sections describing that property’s nested schemaReturn the schema information in a format that is directly usable for template authoring.
Constraints:
required focus, You MUST list ONLY required properties and explicitly state “the remaining properties are optional” rather than omitting them silentlyGuide the user on how to use the information.
Constraints:
resource_type: AWS::Lambda::Function
focus: requiredRequired properties for AWS::Lambda::Function
Source: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
| Name | Type | Update requires | Notes |
|---------|--------|-----------------|-------|
| Code | Code | No interruption | Either ZipFile, S3Bucket+S3Key, or ImageUri |
| Role | String | No interruption | IAM role ARN (must match ^arn:aws:iam::\d{12}:role/.+$) |
Example:
MyFunction:
Type: AWS::Lambda::Function
Properties:
Role: !GetAtt MyLambdaRole.Arn
Code:
ZipFile: |
def handler(event, context):
return {'statusCode': 200}
The remaining properties (Runtime, Handler, etc.) are conditionally required
or optional depending on deployment type. Tell me if you want the full
property list.Some resource types use aws-properties- instead of aws-resource- in the URL path (historical naming). Try both variants before falling back to search.
The Console sometimes exposes additional UI-only fields that do not exist in the CloudFormation schema. The documentation is authoritative for CloudFormation property names.
Some service names are not obvious (e.g., AWS::IAM::Role is iam-role, but AWS::EC2::SecurityGroup is ec2-securitygroup — CamelCase words are not split). If the URL derivation fails, search the CloudFormation User Guide for the resource type by its full name.