aws-api-gateway

Cognito user pool authorizer With Serverless Framework

廉价感情. 提交于 2019-12-13 11:36:15
问题 I need to authorize my API end point using aws cognito userpool. I can do it manually, but I need to automate the authorization part with the serverless framework. Does the Serverless framework have support for aws cognito? If so, how do we setup an aws-userpool with serverless? 回答1: Yes . Serverless ( v1.5 ) support to Cognito user pool authorizer. If you use previous version of serverless you have to update v1.5 or later. For the user-pool authorization of api end point you have to specify

Is it safe to authenticate a Cognito User through API Gateway to Lambda using a custom property?

微笑、不失礼 提交于 2019-12-13 06:59:46
问题 I'm currently using a Cognito User Pool as an authorizer for an API Gateway endpoint, through to a Lambda function. Can I pass the Integrated Request on to Lambda and SECURELY allow or deny from inside Lambda based on a custom attribute? Mapping: "administrator" : "$context.authorizer.claims['custom:administrator']", Lambda handler: boolean isAdmin = Boolean.parseBoolean(request.getContext().get("administrator")); if(isAdmin) etc... To be clear, a user that is NOT an administrator should not

KeyConditions and KeyConditionExpression fail in Python

痞子三分冷 提交于 2019-12-13 03:45:32
问题 I am trying to modify the lambda-microservice example to submit a GET query to dynamodb from an aws-api-gateway. I have gotten the example to work but it does a table scan, not a query. The query fails trying to set the KeyConditionExpression with the following message: "Lambda execution failed with status 200 due to customer function error: name 'Key' is not defined." The relevant python is here: operations = { 'GET': lambda dynamo, x: dynamo.query(**x), } dynamodb = boto3.resource('dynamodb

Unable to integrate API gateway with aws lambda

落爺英雄遲暮 提交于 2019-12-13 03:43:24
问题 I am trying to integrate AWS API Gateway with an AWS lambda function. The integration works flawlessly until I use the 'Lambda Proxy integration' in my Integration Request. When I check 'Use Lambda Proxy integration' in my integration request, I start getting: "Execution failed due to configuration error: Malformed Lambda proxy response" I googled around a bit and realized that I need to send back the response in a certain format: { "isBase64Encoded": true|false, "statusCode": httpStatusCode,

Creating a private Amazon API Gateway

三世轮回 提交于 2019-12-13 03:37:20
问题 I want to create an api for my app that is only accessible by my app. I have added the AWS Cognito identity to my appDelegate like so: AWSCognitoCredentialsProvider *credentialsProvider = [[DeveloperAuthenticationProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"poolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider]; AWSServiceManager.defaultServiceManager

how to correctly use integration response mapping in aws api gateway to return different http codes

谁说我不能喝 提交于 2019-12-12 22:12:42
问题 I can't seem to set my integration response for errors using the amazon api gateway I added an integration response but it does not return the 400 error, instead it continues to return 200 response with { "errorMessage": "foose", "errorType": "Error", "stackTrace": [ "exports.handler (/var/task/index.js:11:19)" ] } 回答1: If you are using the Java, you need to throw an Exception. I made the mistake of trying to return the error information. The Lambda Error Regex parses the Exception message so

Can an S3 bucket generate its own object key names?

时光怂恿深爱的人放手 提交于 2019-12-12 20:12:32
问题 I'm configuring the Amazon API Gateway as a proxy for an S3 bucket. Ideally, I'd like the client to be able to POST a file to a bucket, have S3 assign it a file name, and then return that name in the response. I don't want to give the client the ability to specify the file name. Is this possible? The documentation for setting up the proxy doesn't mention POST at all, and other POST examples I've found still require the client to specify the key name. 回答1: No, auto file name generation isn't

How to create a private AWS Api Gateway using cloudformation?

旧巷老猫 提交于 2019-12-12 18:50:18
问题 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 resource policy via the CF template - Following is the swagger definition of the resource policy - x-amazon-apigateway-policy: Version: "2012-10-17" Statement: - Effect: "Deny" Principal: "*" Action: "execute-api:Invoke" Resource: "arn:aws:execute-api:us-east-1:awsAccountId:xxxx/*/*/*" Condition:

AWS API Gateway not working with custom domain

烈酒焚心 提交于 2019-12-12 16:46:56
问题 I've created an expressjs api and hosted in AWS lambda with an api gateway for the same. It is working fine as expected with the url: https://[api-id].execute-api.[region].amazonaws.com/prod/api/v1/todos But I want to invoke it using a custom domain and I confgiured it using the custom domain option of the api gateway. I've registered my domain using google domains and I've added the CNAME entry in DNS configuration to map it to the cloudfront target domain name. So far so good. The api

passing query params for aws lambda function

一曲冷凌霜 提交于 2019-12-12 13:22:17
问题 I am trying to set up a Lambda function that will pull query params that are passed into the API Gateway URL that is created. (Sidebar: I am still pretty green when it comes to programming, so please forgive any unintentional confusion regarding how to name things on my part). I've wrapped a few REST calls within a fiber using Synchronize.JS, and it works great when I hard code the variables that I want to pass into the various REST urls, but our goal is to be able to pass different