All Questions
Tagged with aws-cloudformation aws-api-gateway
398
questions
66
votes
11
answers
40k
views
CloudFormation doesn't deploy to API gateway stages on update
When I run CloudFormation deploy using a template with API Gateway resources, the first time I run it, it creates and deploys to stages. The subsequent times I run it, it updates the resources but ...
64
votes
8
answers
94k
views
AWS API Gateway: User anonymous is not authorized to execute API
Trying to post to an API I've created in API gateway:
{
"Message": "User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:us-west-2:***********:...
46
votes
6
answers
32k
views
Enable CORS for API Gateway in Cloudformation template
I'm creating AWS Cloudformation template for my environment and I can't find a way to enable CORS for API Gateway method.
I can configure it using AWS console (here is the official doc), but how can ...
27
votes
3
answers
30k
views
How can I grant permission to API Gateway to invoke lambda functions through CloudFormation?
I've been all over the web searching for an answer to this.
Essentially, we're spinning up an API using Swagger, which is awesome and works great, but one thing doesn't work... When we make a call to ...
26
votes
3
answers
13k
views
Export existing AWS Lambda and API Gateway to Cloudformation template
How to export existing configured and tested infrastructure (including AWS Lambda functions, API Gateways, ElastiCache clusters, Cloudwatch rules) to Cloudformation template?
I know about ...
25
votes
3
answers
15k
views
Serverless Framework add Lambda to an Existing VPC and Subnet
Is it possible to create a Serverless Framework Lambda deployment where the Lambda is deployed into an existing VPC's SecurityGroup? I don't want the service deployment or it's stack to own an of the ...
24
votes
4
answers
13k
views
How do I cloudform an API gateway resource with a lambda proxy integration
I've been trying to work out how to express (in cloudformation) an API Gateway Resource that has a Lambda function integration type using the Lambda Proxy integration.
This is easy to do in the AWS ...
19
votes
2
answers
14k
views
How to integrate API Gateway with SQS
Just like in the title. I try to integrate API Gateway method with a SQS using cloud formation. What I am missing is the correct URI for the SQS. If any of you already did that, what should the URI ...
18
votes
2
answers
38k
views
Getting an error trying to create an AWS API Gateway via Cloudformation
I'm trying to make a simple Cloudformation to create a website hosted on S3 with an API Gateway backend. Everything seems OK as far as I can tell but I get errors when trying to create the API Gateway:...
16
votes
4
answers
25k
views
enabling CORS for AWS API gateway with the AWS CDK
I'm trying to build an application with the AWS CDK and if I were to build an application by hand using the AWS Console, I normally would enable CORS in API gateway.
Even though I can export the ...
16
votes
5
answers
30k
views
Fix CORS "Response to preflight..." header not present with AWS API gateway and amplify
I've been struggling so long with the error below. I've tried so many tutorials and stackoverflow answers and none of the solutions fixes my problem.
Access to XMLHttpRequest at
'https://xxx' ...
15
votes
3
answers
8k
views
Set API Key to be required for AWS ApiGateway endpoint (Swagger import)
I try to define my AWS Api Gateway infrastructure using Swagger/OpenAPI. Everything is working so far, however I have problems enabling the need for an API-Key for my endpoints.
My Swagger file looks ...
14
votes
4
answers
11k
views
How to enable Cloudwatch logging for AWS API GW via Cloudformation template
I am trying to enable cloudwatch logs for AWS API Gateway via cloudformation template but it does not enables. I have tried setting up logginglevel to INFO in both Stage description and also Method ...
14
votes
2
answers
4k
views
How to get the target domain name of a custom domain for Regional AWS API Gateway in Cloudformation?
I'm trying to create a multi-region serverless application on AWS. I've followed the instructions given here. I'm using Serverless framework, which uses Cloudformation scripts for creating all the ...
13
votes
1
answer
1k
views
AWS SAM : Nested Stacks, Referring to API gateway from the Root stack
I want to split my SAM application into multiple parts.
I want to create a API ( AWS::Serverless::Api ) in the root stack.
I am creating lambda functions in my child stacks, where I want to give the ...
12
votes
1
answer
8k
views
How to provide AWS API Gateway Custom Authorizer a Lambda Permission?
I have an AWS Lambda function, to which I am trying to provide permission after successfully setting it as an Authorizer.
Basically I want to achieve the following in CloudFromation -
Following is ...
12
votes
1
answer
5k
views
AWS Api Gateway proxy resource using Cloudformation?
I'm trying to proxy an S3 bucket configured as a website from an API Gateway endpoint. I configured an endpoint successfully using the console, but I am unable to recreate the configuration using ...
11
votes
1
answer
8k
views
How to create a nested Resource path in AWS RestAPI using Cloudformation?
Can somebody explain the parentId property of aws resource type AWS::ApiGateway::Resource ?
Documentation can be found here , Documentation is very much limited and only shows how to get the ...
11
votes
7
answers
16k
views
How do I force redeployment of my API Gateway using Cloudformation
I'm using AWS CloudFormation to create an API gateway. I have a AWS::ApiGateway::Deployment resource, which works great when I create my stack. However, if I update my stack (with a change in the AWS::...
11
votes
4
answers
4k
views
Need to configure serverless resource output to get api gateway api id
I have a serverless project that is creating an API Gateway API amongst other things. One of the functions in the project needs to generate a URL for an API endpoint.
My plan is to get the API ID ...
11
votes
3
answers
4k
views
In AWS API Gateway, can I use a Usage Plan without attaching an API Key?
AWS documentation on API Gateway Usage Plans all imply that they're created with/attached to API Keys, but don't state how it will behave without one. I have an unauthorized API that I would like to ...
10
votes
2
answers
11k
views
AWS Cloudformation Link API Key to API Gateway
I have the following Cloudformation template I am trying to deploy via SAM. This template correctly creates the DynamoDB table, an API Key, a Lambda function and the API Gateway, but I cannot figure ...
10
votes
2
answers
21k
views
Invalid domain name identifier specified
When trying to create an AWS::ApiGateway::BasePathMapping through CloudFormation, I am given the following error:
Invalid domain name identifier specified
Below is the portion(s) of my ...
10
votes
2
answers
5k
views
how to enable api gateway logs via cloud formation template (serverless.yml)?
I want to enable api gateway logs for my api gateway which is the wraparound for my lambda function.
service: myservice
provider:
name: aws
runtime: python3.6
stage: ${opt:stage}
region: ${...
9
votes
1
answer
2k
views
Adding integration response to AWS websocket API with CloudFormation
AWS recently released Cloudformation support for templating websocket API gateways. I have a working example deployed, but I can't work out how to turn on the proxy integration response (see ...
9
votes
5
answers
5k
views
Is there no setting for AWS API Gateway REST API to disable execute-api endpoint in CloudFormation template?
I have setup an API Gateway (v1, not v2) REST API resource using CloudFormation template. Recently I have noticed that the default execute-api endpoint is also created, which I can disable in the ...
9
votes
3
answers
10k
views
AWS API Gateway Method Response in CloudFormation
I am trying to set up my API Gateway so it has this simple method response:
And I am using CloudFormation and I keep running into errors. I believe this is pretty simple but I am stuck after ...
9
votes
0
answers
2k
views
Custom domain name for api , domain already exists in the stack
I want to create a custom api for my gateway I'm following this tutorial , https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html
I pre createed my ...
9
votes
3
answers
10k
views
Custom domain for API Gateway using CloudFormation
I'm trying to define a custom domain (sub domain actually) for an API Gateway using CloudFormation. According to all the documentation I've been able to find the following should work but when I ...
8
votes
4
answers
22k
views
AWS CloudFormation/API Gateway gives 'Invalid Resource identifier specified'
I have been trying to use CloudFormation to deploy to API Gateway, however, I constantly run into the same issue with my method resources. The stack deployments keep failing with 'Invalid Resource ...
8
votes
2
answers
1k
views
API Gateway with SAM isn't updated correctly
We use Cloud Formation for define a bunch of Lambda functions:
AWSTemplateFormatVersion: '2010-09-09'
Transform:
- 'AWS::Serverless-2016-10-31'
Resources:
MyLambda:
Type: 'AWS::Serverless::...
8
votes
1
answer
3k
views
AWS API Gateway RestAPI CloudFormation update does not update Deployment resource
When I update a RestApi resource using CloudFormation update-stack, it does not update the corresponding Deployment resource.
My initial stack looks like this
Resources :
RestApi
/...
8
votes
1
answer
2k
views
In AWS Codestar, how to configure branch deployments to specific environments?
I just created a brand new AWS Codestar project.
As far as I can tell, that Codestar is just a dashboard that integrates multiple AWS products.
There is one thing that I don't know how to ...
8
votes
2
answers
1k
views
Adding integration response to AWS websocket API with @aws-cdk/aws-apigatewayv2
Is there a way to add an integration response to the AWS WebSocket API using AWS CDK with the aws-apigatewayv2 package? This answer shows a great way to achieve just that using CloudFormation. But I ...
7
votes
1
answer
7k
views
AWS SAM template/cloudformation No integration defined for method (Service: AmazonApiGateway
I am trying to deploy a lambda function and API gateway . I create a .net core web API project with AWS CLI . Deploying only the function and creating the API gateway and resource manually on aws ...
7
votes
1
answer
4k
views
VPC endpoint in Cloudformation - Endpoint type (Gateway) does not match available service types ([Interface])
I'm trying to create a VPC endpoint for API Gateway in Cloudformation, but got this error:
Endpoint type (Gateway) does not match available service types ([Interface]).
The template below is placed ...
7
votes
2
answers
8k
views
Describe AWS API Gateway Body Mapping Templates in CloudFormation
I looked though the documentation but didn't find a way to do this. I have a API Gateway method that has a Body Mapping Template, as in the picture attached.
How do I map this template in ...
7
votes
1
answer
2k
views
"Log full requests/responses data" in cloudformation
The AWS AWS::ApiGateway::Deployment StageDescription docs don't seem to reference the option "Log full requests/responses data" in the API gateway stage settings. I want to ensure it is ...
7
votes
3
answers
4k
views
Disabling security for one method resource endpoint in API Gateway via AWS SAM template
I'm using AWS Serverless to create an API Gateway backed with Lambda functions.
I have the following resources and methods defined:
/projects
-> GET (should require API key)
-> OPTIONS (...
7
votes
1
answer
4k
views
AWS CloudFormation API GatewayV2 Route Creation
I am creating a template to create an http api with apigatewayv2.
My API definition in template is:
sfHttpApi:
Type: AWS::ApiGatewayV2::Api
DependsOn: sfLambdaFunction
Properties:
...
7
votes
1
answer
7k
views
How to create API Gateway Resource Policy that references itself in the Python CDK?
I'm creating an API that will ONLY accept requests made from the GitHub Webhook servers by using a Resource Policy with the GitHub IPs. I've successfully done this using the console and manually ...
7
votes
1
answer
2k
views
How can one return binary content via AWS Lambda through API Gateway and CloudFront using AWS_PROXY mode?
How can I provision an AWS API Gateway, fronted by CloudFront (so that I can have HTTP to HTTPS redirects) and backed by an AWS Lambda function using the AWS_PROXY integration type using ...
7
votes
1
answer
4k
views
AWS SAM: No 'Access-Control-Allow-Origin' header is present on the requested resource response
I'm working to get a static website to call API gateway using CORS. I've got the code below running using SAM local, but I'm getting the following CORS error trying to call my API with jQuery from my ...
7
votes
0
answers
3k
views
Nested Fn::ImportValue in Fn::Sub not working for SAM template
Description:
I am trying to define Serverless API resource. But having trouble in defining location of swagger specification file using function ImportValue.
Steps to reproduce the issue:
I am not ...
6
votes
4
answers
8k
views
Passing ARN reference from CloudFormation to Swagger
We are trying to automate the deployment of AWS lambda and API gateway using Amazon CloudFormation and Swagger. Towards this, we have created a CloudFormation template to create the Lambda and other ...
6
votes
3
answers
2k
views
SAM Template - define HttpApi with Lambda Authorizer and Simple Response
Description of the problem
I have created a Lambda function with API Gateway in SAM, then deployed it and it was working as expected. In API Gateway I used HttpApi not REST API.
Then, I wanted to add ...
6
votes
1
answer
5k
views
What is the difference between AWS and AWS_PROXY in CloudFormation::APIGateway?
What is the difference between AWS and AWS_PROXY in a CloudFormation template with a AWS::ApiGateway::Method - Integration:Type, with a Lambda backend? I was constantly getting 502 errors just now and ...
6
votes
1
answer
7k
views
How to create a private AWS Api Gateway using cloudformation?
I am trying to create an AWS API Gateway of PRIVATE type,
This requires a resource policy, which I have as I'm able to create the gateway from the AWS Console,
I wanted to know how I could add the ...
6
votes
1
answer
4k
views
AWS CloudFormation stack: API Gateway resource with nested paths?
I have an API Gateway resource manually built that looks like:
GET
/assets/{items} - (points to S3 bucket)
/{proxy+} - points to Lambda function
I would like to mimic this setup in a ...
6
votes
1
answer
4k
views
Correct CloudFormation For Route53 RecordSet to API Gateway
I'm trying to deploy a CloudFormation template (through AWS CLI) that contains DynamoDB and some Lambdas served through API Gateway. The following is the template:
Resources:
UTableArticle:
...