Let's create an API with CORS enabled from scratch. Steps 1 to 4 are the same as we have seen in Chapter 2, Building Serverless REST APIs with API Gateway:
- Create an API:
aws apigateway create-rest-api \ --name 'API WITH CORS' \ --region us-east-1 \ --profile admin
- Get the ID of the root resource path \:
aws apigateway get-resources \ --rest-api-id xenqybowjg
- Create a resource greeting under the root path:
aws apigateway create-resource \ --rest-api-id xenqybowjg \ --parent-id p8yd8xde55 \ --path-part greeting
- Create a subresource ...