Let's create the same API that we created in the previous recipe, but do it by using a CloudFormation template, and then deploy it using the AWS CLI. Finally, we will invoke the API from a browser. The CLI commands corresponding to the CloudFormation template components were already discussed in the previous recipe:
- Start by defining the template with AWSTemplateFormatVersion and a description, as follows:
---AWSTemplateFormatVersion: '2010-09-09'Description: Building API with AWS CloudFormation
- Define our REST API with the resource type AWS::ApiGateway::RestApi, as follows:
Resources: MyFirstRestAPI: Type: AWS::ApiGateway::RestApi Properties: Name: Greeting API Description: API for greeting an user FailOnWarnings: true ...