aws-api-gateway

AWS Lambda and API Gateway response integration issue

生来就可爱ヽ(ⅴ<●) 提交于 2020-04-30 04:37:50
问题 I have deployed AWS stack with a Lambda function and an API gateway. After deployment I tested Lambda function independently and it works fine but when I invoke it using AWS API Gateway, it fails with ` Internal Error: 502 I looked at cloudwatch logs and it says Endpoint response body before transformations: null I am returning my response from Lambda (Python 3.6) in following way - body = { "message": "Success!!" } response = { "statusCode": 200, "headers": { "content-type": "application

CORS impossible on AWS Lambda HTTP API Gateway Integration

别等时光非礼了梦想. 提交于 2020-04-28 19:04:31
问题 An AWS Lamba function (NodeJS) returning 3 HTTP headers: aaa, Access-Control-Allow-Origin and bbb was created: exports.handler = async (event) => { const response = { statusCode: 200, headers: { "aaa":"aaa", "Access-Control-Allow-Origin":"*", "bbb":"bbb" }, body: JSON.stringify('Hello from Lambda!'), }; return response; }; The function is integrated into a HTTP API (not REST API). In the HTTP API Gateway Configuration, Section "Configure CORS", the HTTP header "Access-Control-Allow-Origin"

CORS impossible on AWS Lambda HTTP API Gateway Integration

China☆狼群 提交于 2020-04-28 19:04:20
问题 An AWS Lamba function (NodeJS) returning 3 HTTP headers: aaa, Access-Control-Allow-Origin and bbb was created: exports.handler = async (event) => { const response = { statusCode: 200, headers: { "aaa":"aaa", "Access-Control-Allow-Origin":"*", "bbb":"bbb" }, body: JSON.stringify('Hello from Lambda!'), }; return response; }; The function is integrated into a HTTP API (not REST API). In the HTTP API Gateway Configuration, Section "Configure CORS", the HTTP header "Access-Control-Allow-Origin"

CORS error, but data is fetched regardless

流过昼夜 提交于 2020-04-13 04:14:39
问题 I have a generated React site I am hosting in an S3 bucket. One of my components attempts to fetch something when loaded: require('isomorphic-fetch') ... componentDidMount() { fetch(`${url}`) .then(res => { console.log(res); this.setState({ users: res }) }) .catch(e => { // do nothing }) } The url I am fetching is an AWS API Gateway. I have enabled CORS there, via the dropdown, with no changes to the default configuration. In my console, for both the remote site and locally during development

What is the best way to restrict access to an Application Load Balancer?

笑着哭i 提交于 2020-04-12 08:22:00
问题 Ideally, I'd like to lock down my ALB so that it can only be accessed by API Gateway. I've looked into whether I can associate API gateway with an Inbound Rule - however, I have found that API Gateway cannot be associated with an IP address, or a security group. I've also looked into an Internal facing ALB, but I've been unable to get these working as VPC link only supports NLB. Any help will be greatly appreciated - I've been looking in the Gateway Settings but cannot find this option. What

What is the best way to restrict access to an Application Load Balancer?

爱⌒轻易说出口 提交于 2020-04-12 08:21:14
问题 Ideally, I'd like to lock down my ALB so that it can only be accessed by API Gateway. I've looked into whether I can associate API gateway with an Inbound Rule - however, I have found that API Gateway cannot be associated with an IP address, or a security group. I've also looked into an Internal facing ALB, but I've been unable to get these working as VPC link only supports NLB. Any help will be greatly appreciated - I've been looking in the Gateway Settings but cannot find this option. What

What is the best way to restrict access to an Application Load Balancer?

核能气质少年 提交于 2020-04-12 08:20:26
问题 Ideally, I'd like to lock down my ALB so that it can only be accessed by API Gateway. I've looked into whether I can associate API gateway with an Inbound Rule - however, I have found that API Gateway cannot be associated with an IP address, or a security group. I've also looked into an Internal facing ALB, but I've been unable to get these working as VPC link only supports NLB. Any help will be greatly appreciated - I've been looking in the Gateway Settings but cannot find this option. What

How to add a request validator in a AWS SAM template for AWS::Serverless::Api?

删除回忆录丶 提交于 2020-04-08 18:08:12
问题 I'm trying to use AWS SAM to link a request validator resource to a serverless API in a SAM template. I have created the request validator and referenced the API in its RestApiId but the validator doesn't get set as the API default validator option in the AWS console. AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > Discription for the template Globals: Function: Timeout: 30 Resources: MyAPI: Type: AWS::Serverless::Api Properties: Name: MyAPI

Cognito Groups with IAM Permissions

╄→尐↘猪︶ㄣ 提交于 2020-04-07 16:49:09
问题 What I want to implement: I have a Cognito User-Pool and I have some Users and some Groups. I want that certain Users have access to API Gateway functions, some Users can access some functions and others have no access. What I did: I created three groups and assigned the Users to each of the groups. I gave each of the groups an IAM role and gave each roled spezific policies. The permission for the group for all users looks like this: { "Version": "2012-10-17", "Statement": [ { "Sid":

AWS Lambda Account Concurrency, Throttling

若如初见. 提交于 2020-03-26 06:40:52
问题 I am considering NOT using API gateway for performance reasons. Instead, I want to expose a lambda function directly to the web. Unauthenticated IAM credentials are required, and provided by the AWS JavaScript SDK. I realize this could be a concern if a bad actor tries to invoke my function at an astronomical pace and cause major billing issues. I don't think this is likely as someone would specifically have to target my application, request IAM credentials and then invoke the request... a