aws-api-gateway

Use custom domain (apex) in AWS API Gateway

最后都变了- 提交于 2019-12-24 10:39:47
问题 I would like to use a custom domain for an AWS API Gateway endpoint, this would allow me to use mydomain.com instead of https://xxxxxxxx.execute-api.eu-west-1.amazonaws.com/v1 . I managed to add the custom domain in API Gateway but now I need to set the DNS of the domain (this domain is NOT managed by Route53). As far as I understand I should set an A record but I don't have any IP provided by the cloudfront distribution and it cannot be a CNAME because I want to bind a domain (apex) not a

How to allow only an IP/range access to AWS API Gateway resources

戏子无情 提交于 2019-12-24 06:34:05
问题 How best can I restrict access to certain routes in AWS API gateway by IP? I want to allow only my ECS cluster to access certain routes in API gateway. I tried putting the ECS NAT gateway, the VPC CIDR range in aws:SourceIp but always get denied. I even tried my personal computer public IP address ... same results ... Is this the correct way? Or should I try IAM authorizers? The downside with IAM authorizer is I need to sign my API calls? Perhaps using the API Gateway SDK? Which means code

Reference an Authorizer definition in an API Gateway path

假如想象 提交于 2019-12-24 04:32:14
问题 I've defined a custom authorizer in my cloudformation template: MyCustomAuthorizer: Type: AWS::ApiGateway::Authorizer Properties: Name: "MyCustomAuthorizer" Type: "TOKEN" AuthorizerUri: "arn:my_lambda" IdentitySource: "method.request.header.Auth" RestApiId: Ref: ApiGatewayApi And I have a Api Gateway API: ApiGatewayApi: Type: AWS::ApiGateway::RestApi Properties: Name: "ApiGatewayApi" Description: "Api gateway REST API" Body: basePath: "/prod" schemes: - "https" paths: /echo: get: consumes: -

Is it possible to connect API gateway with node routes in AWS lambda?

谁说胖子不能爱 提交于 2019-12-24 01:58:06
问题 I have implemented node application with AWSServerlessExpress and deployed in Lambda function. but unable to point API Gateway to node routes. every time I'm getting 404 status. var express = require('express') , router = express.Router() router.post('/es', function(request, response){ response.status(200).send("Lambda is triggered"); response.end() }) router.get('/es/csv', function(request, response){ response.status(200).send("hello"); response.end() }) module.exports = router; How can I

CORS defeats AWS LAMBDA :(

倾然丶 夕夏残阳落幕 提交于 2019-12-24 01:14:08
问题 I've been reading a lot on CORS/Lambda/AWS API Gateway configuration, including AWS's setup help: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html And this great article: https://serverless.com/framework/docs/providers/aws/events/apigateway/ However, CORS is still defeating my API Gateway / Lambda function and I can't figure it out. Would love some help. The meat of it seems to be that API Gateway proxies the request onto Lambda and you need to set "Access-Control

How to pass cognito identity id to backend

怎甘沉沦 提交于 2019-12-23 21:57:44
问题 I would like to use Api gateway as http proxy of my API restful. I use Cognito to authorize the access to the API gateway as well as my endopoint. I think to use the cognito identity id to identify the user but I don't know how pass this context variable to the backend for each request (GET, POST, PUT...) Can you help me? Thank you Agostino 回答1: Define a request mapping template and use "$context.identity.cognitoIdentityId" to get the cognito identity ID. i.e. { "cognito-identity" : "$context

How to return error collection/object from AWS Lambda function and map to AWS API Gateway response code

亡梦爱人 提交于 2019-12-23 21:14:53
问题 I am attempting to return an object from a AWS Lambda function instead of a simple string. // ... context.fail({ "email": "Email address is too short", "firstname": "First name is too short" }); // ... I have already used the errorMessage for mapping error responses to status codes and that has been great: // ... context.fail('That "username" has already been taken.'); // ... Am I simply trying to do something that the AWS API Gateway does not afford? I have also already found this article

How to Enable CORS for an AWS API Gateway Resource

▼魔方 西西 提交于 2019-12-23 19:40:22
问题 I created REST API using AWS API Gateway & AWS Lambda and when I configured CORS I faced with such issue - I was able to configure CORS response headers for OPTIONS method, but didn't for GET method. I made it according Amazon documentation, but when I called GET method I didn't see required headers (Access-Control-Allow-Methods, Access-Control-Allow-Headers, Access-Control-Allow-Origin) in response. Due to that I got errors on client side: Failed to load #my_test_rest#: No 'Access-Control

How to get API gateway url in AWS lambda function?

守給你的承諾、 提交于 2019-12-23 19:01:07
问题 I have a scenario where I am using an API URL to invoke lambda function. After invoking the lambda function, I want that particular URL in the lambda function. https://******.execute-api.eu-west-1.amazonaws.com/test/first https://******.execute-api.eu-west-1.amazonaws.com/test/second From this URL, I want the resource named first or second in lambda. Here the test is the stage name where I deplou\y my API. I have multiple resources created from that I want to change the behavior of lambda.

Using API Gateway to publish SNS topics / multiple lambda function with API Gateway

强颜欢笑 提交于 2019-12-23 13:09:04
问题 Right now my requirement is, whenever I get data through API, I have to save it into 2-3 different places (for example, into my own DB, into some BI service and also sometimes into a logging DB). I don't know if it's possible to bind a single resource and single method into multiple lambda functions or so. So, my alternate approach was, as I already know how to trigger multiple lambda functions by subscribing to SNS topic, I thought maybe if I can somehow publish to SNS topic from the API