AWS::ApiGateway::Resource
The AWS::ApiGateway::Resource resource creates a resource in an Amazon API Gateway (API Gateway) API.
Topics
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:StringPathPart:StringRestApiId:String
Properties
ParentId-
If you want to create a child resource, the ID of the parent resource. For resources without a parent, specify the RestApi root resource ID, such as
{ "Fn::GetAtt": ["MyRestApi", "RootResourceId"] }.Required: Yes
Type: String
Update requires: Replacement
PathPart-
A path name for the resource.
Required: Yes
Type: String
Update requires: Replacement
RestApiId-
The ID of the
RestApiresource in which you want to create this resource.Required: Yes
Type: String
Update requires: Replacement
Return Value
Ref
When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the resource ID, such as abc123.
For more information about using the Ref function, see Ref.
Example
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: Fn::GetAtt: - "MyApi" - "RootResourceId" PathPart: "stack"
