aws-api-gateway

AWS API Gateway: How to pass IAM identity to Lambda function?

老子叫甜甜 提交于 2019-12-20 10:29:52
问题 I've successfully configured IAM-authenticated access to my Lambda function with AWS API Gateway front-end, but unable to find how to pass IAM user identity to my Lambda function. I need exactly IAM user identity and can not run Lambda function under calling IAM-user credentials. All I need - is to get calling IAM-user identity in my Lambda function. Is there option for that? 回答1: Support for accessing identity and other information from the Amazon API Gateway request context hadn't been

How to point ApiGateway to a specific Lambda alias

不羁的心 提交于 2019-12-20 09:16:14
问题 I created a resource in Amazon's ApiGateway. It is pointing to a Lambda function. This is being hit by a native mobile application (android and ios) which is already in the wild. I now want to modify the Lambda function, but I see no way to change my ApiGateway resource to point to an alias of the lambda. This is my first time playing with any of these technologies and I see no easy mechanism to manage this in the aws console. How can I modify my ApiGateway resource to point to my lambda

Lambda function -> Api Gateway stage variable permission manually

风流意气都作罢 提交于 2019-12-20 06:15:16
问题 You defined your Lambda function as a stage variable; you must manually give permissions to all the functions you will use. You can do this by running the below AWS CLI command for each function, replacing the stage variable in the function-name parameter with the necessary function name. aws lambda add-permission --function-name arn:aws:lambda:eu-west-1:12345:function:test${stageVariables.functionAlias} --source-arn arn:aws:execute-api:eu-west-1:12345:dsad667asd/*/GET/test/test --principal

Data modified on AWS API Gateway Response body

五迷三道 提交于 2019-12-20 04:27:24
问题 I am trying to return hexadecimal string as response from my AWS Lambda function. When it reaches to the client the data seems to be modified. Data : 47 49 46 38 39 61 01 00 01 00 80 00 00 00 00 00 ff ff ff 21 f9 04 01 00 00 01 00 2c 00 00 00 00 01 00 01 00 00 08 04 00 03 04 04 00 3b Hexadecimal Excaped Data ( Sent Data ): \x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00" "\xff\xff\xff\x21\xf9\x04\x01\x00\x00\x01\x00\x2c\x00\x00\x00\x00" "\x01\x00\x01\x00\x00\x08\x04\x00\x03

Cloudformation does not support create vpc links in apigateway

时光总嘲笑我的痴心妄想 提交于 2019-12-19 21:27:32
问题 In aws api gateway there is a section called API Link and I can manually set that. The problem is I cannot find any section in cloudformation documentation on how I can create vpc link via cloud formation on api gateway. Is it sth that cloudformation does not support or am I missing it? 回答1: You can use swagger to define an API Gateway using VPC Link. This is a complete CloudFormation template you can deploy to test it out... { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Test

upload binary from api gateway to S3 bucket

余生颓废 提交于 2019-12-19 10:59:11
问题 i was trying to create a rest api which can take zip file as input (PUT requst) and store that on S3. I'm following the tutorial on http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-content-encodings-examples-image-s3.html I'm getting 500 error ad the cloudwatch logs are as follows Verifying Usage Plan for request: c2140431-1a10-11e7-9f32-0df3853848fe. API Key: API Stage: xjjd186a30/rd API Key authorized because method 'PUT /s3' does not require API Key. Request will not

Upload Image into S3 bucket using Api Gateway, Lambda funnction

耗尽温柔 提交于 2019-12-19 08:54:06
问题 I'm trying to upload the image (base64) from the postman, I can see when I hit the Serverless API, something has been added in S3 bucket but not image, I'm using nodejs Lambda function, I tried so many solutions but that didn't work out. Please suggest me where I'm wrong: const AWS = require('aws-sdk'); const s3 = new AWS.S3(); const moment = require('moment'); const fileType = require('file-type'); const sha1 = require('sha1'); const multipart = require('parse-multipart'); exports.handler =

How to pass cognito user information to lambda?

空扰寡人 提交于 2019-12-19 06:03:22
问题 I'm developing application based on API Gateway and Lambda. I configured POST /subscribe as "AWS_IAM". So now it cannot accessible directly, but I can access to API with Cognito authentication. Now problem is my Lambda doesn't know who is the API caller. How to know that? I have 2 users: "Bob" and "John". My Lambda need to know that caller is Bob or John. Thanks, 回答1: You can get the Cognito Identity ID from the identity property of the context parameter ( context.identity ) as explained in

Invoke AWS Lambda and return response to API Gateway asyncronously

时光怂恿深爱的人放手 提交于 2019-12-19 03:44:14
问题 My use case is such that I'll have an AWS Lambda front ended with API Gateway. My requirement is that once the Lambda is invoked it should return a 200 OK response back to API Gateway which get forwards this to the caller. And then the Lambda should start its actual processing of the payload. The reason for this is that the API Gateway caller service expects a response within 10 seconds else it times out. So I want to give the response before I start with the processing. Is this possible? 回答1

How to config the api gateway for the service deployed in private subnet?

风流意气都作罢 提交于 2019-12-18 23:48:09
问题 I deployed a web service in my private subnet without ELB in public subnet. Now I want to expose it to public. Can I use API gateway as the http proxy to make it public? Anyone knows how to do that? 回答1: The service has to be public for API Gateway to be able to connect to it. You can use SSL Client certs to restrict access to only API Gateway. Otherwise, API Gateway would not be a good solution to your issue. Update: You can now configure API Gateway to access resources inside a VPC using