After we create the API, we can now create our first resource, which will be a test resource, and remove it later. We can add these lines to the end of our resources in order to create the resource:
"TestResource": { "Type": "AWS::ApiGateway::Resource", "Properties": { "PathPart": "test", "RestApiId": { "Ref": "RestApi" }, "ParentId": { "Fn::GetAtt": [ "RestApi", "RootResourceId" ] } } }
If we analyze this resource, we can see that the resource type is AWS::ApiGateway::Resource . In the properties part, we can see PathPart , and we set it as test. It will create a REST resource and will be invoked when https://base_url/test is requested. Here, we can use brackets to create a dynamic parameter. For example, {test} would match both https://base_url/1 and https://base_url/2, and we can use these parameters to pass to our Lambda function. The RestApiId property refers to the AWS::ApiGateway::RestApi resource we just created, and ParentId refers to the RootResourceId value of the RestApi resource.