All Questions

Filter by
Sorted by
Tagged with
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 ...
bjfletcher's user avatar
  • 11.3k
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:***********:...
tgk's user avatar
  • 4,006
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 ...
dds's user avatar
  • 2,405
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 ...
Sam Bantner's user avatar
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 ...
Hleb's user avatar
  • 7,151
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 ...
Ryan Fisch's user avatar
  • 2,634
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 ...
sihil's user avatar
  • 2,641
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 ...
greg's user avatar
  • 1,897
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:...
Justin808's user avatar
  • 21.3k
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 ...
Ivan Kluzak's user avatar
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' ...
PouncingPoodle's user avatar
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 ...
philsch's user avatar
  • 1,034
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 ...
Athi's user avatar
  • 383
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 ...
Rahul Bobhate's user avatar
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 ...
Dattatray's user avatar
  • 1,835
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 ...
Dev1ce's user avatar
  • 5,700
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 ...
Christian Johansen's user avatar
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 ...
Veer3383's user avatar
  • 1,805
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::...
Manu's user avatar
  • 275
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 ...
Peter Whitfield's user avatar
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 ...
jayjyli's user avatar
  • 781
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 ...
Denny's user avatar
  • 103
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 ...
Jacob Lambert's user avatar
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: ${...
Nagalakshmi Srirama's user avatar
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 ...
Matthew de Nobrega's user avatar
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 ...
Marceli Wac's user avatar
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 ...
Moneer81's user avatar
  • 295
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 ...
Shachaf.Gortler's user avatar
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 ...
Ava's user avatar
  • 2,072
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 ...
user3067870's user avatar
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::...
BAD_SEED's user avatar
  • 4,960
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 /...
MichaelW's user avatar
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 ...
ILikeTacos's user avatar
  • 18.1k
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 ...
Martin Šťáva's user avatar
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 ...
jhurtas's user avatar
  • 615
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 ...
Katie 's user avatar
  • 891
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 ...
June's user avatar
  • 592
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 ...
Morgoth's user avatar
  • 5,084
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 (...
Yu Chen's user avatar
  • 7,040
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: ...
Mahbub Rahman's user avatar
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 ...
Jamie's user avatar
  • 1,676
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 ...
gene_wood's user avatar
  • 2,024
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 ...
curiouscat's user avatar
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 ...
Noman Yaqub's user avatar
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 ...
Jeffrey M's user avatar
  • 111
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 ...
mastazi's user avatar
  • 1,642
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 ...
Chris's user avatar
  • 567
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 ...
Dev1ce's user avatar
  • 5,700
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 ...
Pat Needham's user avatar
  • 5,808
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: ...
Michael Coxon's user avatar

1
2 3 4 5
8