aws-lambda

Access AWS Athena from Python Lambda in different account

久未见 提交于 2020-03-25 18:21:37
问题 I have two account A and B. S3 Buckets and Athena View is in account A and Lambda is in Account B. I want to call Athena from my Lambda. I have also allowed Lambda Execution Role in S3 Bucket Policy. When I try to call Database from Lambda, it gives me error as 'Status': {'State': 'FAILED', 'StateChangeReason': 'SYNTAX_ERROR: line 1:15: Schema db_name does not exist' Below is my Lambda Code: import boto3 import time def lambda_handler(event, context): athena_client = boto3.client('athena')

Access AWS Athena from Python Lambda in different account

本秂侑毒 提交于 2020-03-25 18:21:10
问题 I have two account A and B. S3 Buckets and Athena View is in account A and Lambda is in Account B. I want to call Athena from my Lambda. I have also allowed Lambda Execution Role in S3 Bucket Policy. When I try to call Database from Lambda, it gives me error as 'Status': {'State': 'FAILED', 'StateChangeReason': 'SYNTAX_ERROR: line 1:15: Schema db_name does not exist' Below is my Lambda Code: import boto3 import time def lambda_handler(event, context): athena_client = boto3.client('athena')

How to integrate API Gateway with Cognito Federated Identity and Cognito User Pools

♀尐吖头ヾ 提交于 2020-03-23 12:39:19
问题 In AWS, I have built an API gateway which invokes a Lambda function. Users gain access by logging in to a Cognito User Pool associated with a Cognito Federated Identity Pool and the associated IAM roles contain API invoke permissions. The API Gateway method is a POST request. If I use the User Pool as the authorizer of the API Gateway I am able to successfully trigger the Lambda function via an ajax request in my javascript web app - note though, this grants the same access to every user in

how can I use proxy+ to handle the root resource on api gateway to return body?

北城以北 提交于 2020-03-23 09:03:14
问题 API Gateway with proxy+ works fine for me, the only thing is that the root path always return "Missing Authentication Token", so I found I should setup "ANY" method for the root path, but it would return the response with header in json. { "statusCode": 200, "body": "{\"message\":\"Welcome!\"}", "headers": { "x-powered-by": "Express", "access-control-allow-origin": "*", "content-type": "application/json; charset=utf-8", "content-length": "22", "etag": "W/\"16-XP9xOOkLTTczHdpNV2DV26X8ykM\"",

Is it possible to connect to database hosted in local machine through AWS lambda

 ̄綄美尐妖づ 提交于 2020-03-22 03:29:07
问题 I launched one RDS instance,s3 and EC2 in AWS and its is triggered properly using lambda. Now I wish to change the change the RDS and EC2 from AWS to local machine. My lambda is triggered from s3. How do I connect the local database through lambda in AWS? 回答1: I agree with John Rotenstein that connecting your local machine to a Lambda running on AWS is probably a bad idea. If your intention is to develop or test locally, I recommend the serverless framework, and the serverless-offline plugin.

Is it possible to connect to database hosted in local machine through AWS lambda

霸气de小男生 提交于 2020-03-22 03:27:47
问题 I launched one RDS instance,s3 and EC2 in AWS and its is triggered properly using lambda. Now I wish to change the change the RDS and EC2 from AWS to local machine. My lambda is triggered from s3. How do I connect the local database through lambda in AWS? 回答1: I agree with John Rotenstein that connecting your local machine to a Lambda running on AWS is probably a bad idea. If your intention is to develop or test locally, I recommend the serverless framework, and the serverless-offline plugin.

Is it possible to connect to database hosted in local machine through AWS lambda

走远了吗. 提交于 2020-03-22 03:26:35
问题 I launched one RDS instance,s3 and EC2 in AWS and its is triggered properly using lambda. Now I wish to change the change the RDS and EC2 from AWS to local machine. My lambda is triggered from s3. How do I connect the local database through lambda in AWS? 回答1: I agree with John Rotenstein that connecting your local machine to a Lambda running on AWS is probably a bad idea. If your intention is to develop or test locally, I recommend the serverless framework, and the serverless-offline plugin.

Using aws-sdk inside lambda? (AWS.ApiGatewayManagementApi is not a constructor at Response)

生来就可爱ヽ(ⅴ<●) 提交于 2020-03-22 02:33:29
问题 I am trying to use aws-sdk inside lambda but I can't seem to figure it out. var AWS = require('aws-sdk'); AWS.config.update(); var DDB = new AWS.DynamoDB({ apiVersion: "2012-10-08" }); exports.handler = function (event, context, callback) { var url_handler = event.requestContext.domainName + "/" + event.requestContext.stage; var scanParams = { TableName: "tbl-web-socket-connection", ProjectionExpression: "id" }; DDB.scan(scanParams, function (err, data) { console.log(err, "Error"); if (err) {

how to include multiple resource files in SAM template.yml

断了今生、忘了曾经 提交于 2020-03-21 06:59:36
问题 I want to write my cloud formation yml file in a different file and load them separately. It is easy to do it in the serverless framework but I couldn't figure it out how to do it with SAM. Would you mind help me how to do it? I provided a copy of the project below: https://github.com/day2daychallenge/nest_application.git my template.yml file: AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > Sample SAM Template # Create our resources with separate

aws lambda django app deployed with zappa - python import precendecy

ε祈祈猫儿з 提交于 2020-03-20 05:59:39
问题 We have a Django application we deploy on AWS Lambda, using Zappa. We use pipenv to manage python packages of the project. Some packages we use (e.g cryptography) need to be compiled with the same configration as the lambda machine. To do that, I've generated wheels for those packages on a similar machine, and included them in a sub folder in the directory. So here is our deployment process now: install packages with pipenv (which also includes those special packages) extract precompiled