Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

AWS::ApiGateway::Resource

Focus mode
AWS::ApiGateway::Resource - AWS CloudFormation
Filter View

The AWS::ApiGateway::Resource resource creates a resource in an API.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::ApiGateway::Resource", "Properties" : { "ParentId" : String, "PathPart" : String, "RestApiId" : String } }

YAML

Type: AWS::ApiGateway::Resource Properties: ParentId: String PathPart: String RestApiId: String

Properties

ParentId

The parent resource's identifier.

Required: Yes

Type: String

Update requires: Replacement

PathPart

The last path segment for this resource.

Required: Yes

Type: String

Update requires: Replacement

RestApiId

The string identifier of the associated RestApi.

Required: Yes

Type: String

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the resource ID, such as abc123.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

ResourceId

The ID for the resource. For example: abc123.

Examples

Create resource

The following example creates a stack resource for the MyApi API.

JSON

{ "Stack": { "Type": "AWS::ApiGateway::Resource", "Properties": { "RestApiId": { "Ref": "MyApi" }, "ParentId": { "Fn::GetAtt": [ "MyApi", "RootResourceId" ] }, "PathPart": "stack" } } }

YAML

Stack: Type: 'AWS::ApiGateway::Resource' Properties: RestApiId: !Ref MyApi ParentId: !GetAtt - MyApi - RootResourceId PathPart: stack

See also

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.