I've followed this tutorial (https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html) to build a basic API.
Then, on the AWS API Gateway for lambda-pipeline-stack I added a custom domain (e.g. api.example.com) which points to a CloudFront distribution.
When I tried changing the template to use POST request instead of GET, I received an error:
This distribution is not configured to allow the HTTP request method that was used for this request.
The distribution supports only cachable requests.
However, when I go into my CloudFront distributions to try to enable POST, that distribution is not accessible. How can I enable POST for this type of API?
Here is my template for reference:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Shows time
Resources:
TimeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs10
CodeUri: ./
Events:
MyTimeApi:
Type: Api
Properties:
Path: /time
Method: POST