aws-api-gateway

Map request into aws service without lambdas and using AWS service proxy integration on Api Gateway

倖福魔咒の 提交于 2020-01-14 06:19:59
问题 So i've got a scenario that i want to use an endpoint and map the provided requests directly into Kinesis stream. I was able to do that manually in the aws console. But is there a way to do change the integration to aws service using serverless or serverless plugin? I tried to find a way to deploy an endpoint that communicates directly with an aws service, without lambdas, and could not find it. 回答1: It's been a while but recently i noticed that there's a plugin now that helps setup this

aws-serverless-express via AWS API gateway asking for authentication even not setup for that

与世无争的帅哥 提交于 2020-01-14 05:34:04
问题 sorry for such 101 question but I'm kinda new with AWS, NodeJS and Express. I'm setting up a basic serverless API Gateway: index.js import AwsServerlessExpress from 'aws-serverless-express'; import App from './src/app'; const server = AwsServerlessExpress.createServer(App); exports.handler = (event, context) => AwsServerlessExpress.proxy(server, event, context); ./src/app.js import Express from 'express'; import BodyParser from 'body-parser'; import AwsServerlessExpressMiddleware from 'aws

How can I make an IP/VPC whitelist for an API in API Gateway?

假如想象 提交于 2020-01-14 02:21:06
问题 We have an API in API Gateway connected to a lambda function. The API has three stages (Dev/Stage/Prod), an API key (required) and a usage plan (connected to all three stages). We're trying to restrict traffic to this API so that Stage/Prod is only accessible from our servers from within our VPC, and Dev is only accessible from our office IP. We have tried using the Resource Policy below, but it doesn't work. Stage/Prod is still accessible from our office IP. { "Version": "2012-10-17",

Using AWS API Gateway to POST email via AWS SES

南楼画角 提交于 2020-01-13 11:37:09
问题 I'm setting up an API from an App which allows the App user to contact someone for follow-up, but hides the email address from the sender (and allows it to be changed without a new release of the App). I've managed to setup an AWS API Gateway GET method which sends email directly via SES https://...aws.com/em/send/en?body=The+email+is+here Using a path override of Action=SendEmail &Source=source%40mydomain.org &Destination.ToAddresses.member.1=follow.up%40anydomain.com &Message.Subject.Data

Secure AWS API Gateway with Lambda Integration

谁说我不能喝 提交于 2020-01-10 15:40:49
问题 I am creating a publicly available API using API Gateway which is backed with lambda functions to do some processing. I have secured it with a custom security header that implements hmac authentication with timestamp to protect against replay attacks. I understand that API Gateway protects against DDOS attacks through its high availability, but any invalid requests will still be passed to the lambda authentication function. So, I guess an attacker can submit invalid unauthenticated requests

How to upload audio file to s3 via api gateway?

这一生的挚爱 提交于 2020-01-07 07:48:13
问题 I created an API in API Gateway to upload audio files to s3, the file is sending from local PC as multipart/form-data. API integration request is shown below In URL Path Parameters, added bucket as param and directly added the bucket name When I try to upload the file I get an error response, body: '<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>InvalidArgument</Code><Message>x-amz-content-sha256 must be UNSIGNED-PAYLOAD, STREAMING-AWS4-HMAC-SHA256-PAYLOAD, or a valid sha256 value.<

creating user using AWS cognito identity

强颜欢笑 提交于 2020-01-07 05:41:34
问题 I am learning to create a serverless API server using AWS lambda, dynamodb, cogito sync. It was going well until I got confused with users table. So basically, I am trying to make twitter clone API. So as user I should be able to create post, follow another users etc. Signup and Signin are successfully handled by Cognito Identity, the problem is how do I access the Users data on the cognito? A user can have following and followers attributes which contains other users ID. What I did currently

Cannot call aws API Gateway via ajax

烂漫一生 提交于 2020-01-07 04:24:09
问题 I am using aws APi gateway and api gateway custom authorizer. The code that I have for api gateway custom authorizer is as follows: console.log('Loading function'); exports.handler = (event, context, callback) => { var token = event.authorizationToken; // Call oauth provider, crack jwt token, etc. // In this example, the token is treated as the status for simplicity. switch (token.toLowerCase()) { case 'allow': callback(null, generatePolicy('user', 'Allow', event.methodArn)); break; case

Specifying Numbers in VTL on AMS API Gateway

↘锁芯ラ 提交于 2020-01-07 03:20:25
问题 Doc Ref: http://docs.aws.amazon.com/apigateway/latest/developerguide/models-mappings.html In AMS VTL one specifies dictionary fields in a model schema thus: "field1" : {"type":"string"}, "field2" : {"type":"number"}, and so a mapping template can populate such fields thus: #set($inputRoot = $input.path('$')) "questions" : [ #foreach($elem in $inputRoot) { "field1" : "$elem.field1", "field2" : $elem.field2 }#if($foreach.hasNext),#end #end ] However... my iOS app complains the received data isn

Invalid PDF Structure error message with Nodejs & pdfkit

半腔热情 提交于 2020-01-06 08:09:52
问题 I am trying to generate a pdf using nodejs & pdfkit. This will be a GET webservice which will be hosted in AWS api gateway. I am trying to run it locally first and getting Invalid PDF structure everytime. Here is my code for it. The pdf file is getting generated properly if I place a local path of my system , but always turns up to be a invalid one if I call from browser or postman. Any help would be highly appreciated 'use strict'; const Actions = require('libs-api').Actions; const config =