First, we will explain the AWS CLI API gateway sub-commands used in this recipe, as follows:
- The create-rest-api command creates a REST API. We also need to specify a name and a region. An API setup with API gateway is region-specific.
- The get-resources command retrieves the root resource identifier of the REST API, which is the path /. You need the ID of this resource to create sub-resources.
- The create-resource command appends a child resource under a parent resource. We created a child, greeting, under the path /, and then created a child for the path param '{name}' under the path greeting, using the corresponding parent IDs. The path-part parameter specifies the path of the resource to add (for example, greeting, {name} ...