aws-lambda

connecting to amazon rds with psycopg2 via lambda

一世执手 提交于 2020-01-05 09:26:10
问题 my code on aws lambda: import sys, boto3, logging, rds_config, psycopg2 rds_host = "hostname" name = rds_config.db_username password = rds_config.db_password db_name = rds_config.db_name s3 = boto3.resource('s3') rds_client = boto3.client('rds',aws_access_key_id=Access_Key,aws_secret_access_key=Secret_Access_Key) instances = rds_client.describe_db_instances() print (instances) try: conn = psycopg2.connect(host=rds_host, database=db_name, user=name, password=password) cur = conn.cursor()

aws lambda error loading redshift jdbc driver

邮差的信 提交于 2020-01-05 08:31:52
问题 I get below error when trying to load Redshift jdbc jar from Aws Lambda. java.io.IOException: Unable to load driver: JAR expected but not found. java.sql.SQLException: No suitable driver found for jdbc:redshift://insightlyanalytics.c0ubofza4jil.us-west-2.redshift.amazonaws.com:5439/analytics;user=xxxh;password=xxx at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:270) at com.insightly.GeoPerformanceReports

aws lambda error loading redshift jdbc driver

白昼怎懂夜的黑 提交于 2020-01-05 08:31:09
问题 I get below error when trying to load Redshift jdbc jar from Aws Lambda. java.io.IOException: Unable to load driver: JAR expected but not found. java.sql.SQLException: No suitable driver found for jdbc:redshift://insightlyanalytics.c0ubofza4jil.us-west-2.redshift.amazonaws.com:5439/analytics;user=xxxh;password=xxx at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:270) at com.insightly.GeoPerformanceReports

API timeouts in AWS Lambda?

戏子无情 提交于 2020-01-05 08:22:13
问题 I'm trying to create a lambda function in AWS which will create a new Stripe token: import stripePackage from 'stripe'; const stripe = stripePackage('...'); module.exports.create = (event, context, callback) => { stripe.tokens.create({ card: { "number": 4242424242424242, "exp_month": '02', "exp_year": '22', "cvc": '123' } }, (err, token) => { if (err) { console.log(err); callback(null, { statusCode: 400, body: "error" }); } callback(null, { statusCode: 200, body: "ok" }); console.log(token);

How do I install Git using AWS Lambda?

≯℡__Kan透↙ 提交于 2020-01-05 07:37:28
问题 I have code in Code commit repository, I am writing a lambda function to build the code for every check-in (event) to the code commit repo. I am not able to install git and hence cloning the repository is not happening. How do I go about it. 回答1: As the others have mentioned installing git on lambda is either really hard or totally impossible. I did a session at reinvent about lambda and step functions and spent some time trying to get it to work. I gave up. An alternative I found more

502 internal server error response from API gateway from lambda function

百般思念 提交于 2020-01-05 07:18:13
问题 this is my lambda function: I've obviously blanked out the config for now exports.handler = (event, context) => { var config = { }; firebase.initializeApp(config) const gymData = firebase.database().ref("gymData/exercises") axios.get('https://------/gymData/exercises.json').then(({data}) => { const returnedData = Object.values(data) const response = { statusCode: '200', body: JSON.stringify(returnedData), headers: { 'Content-Type': 'application/json', } } context.succeed(response) }) }; when

Unable to import lxml etree on aws lambda

左心房为你撑大大i 提交于 2020-01-05 06:27:22
问题 { "errorMessage": "Unable to import module 'lambda_function': cannot import name 'etree' from 'lxml' (/var/task/lxml/__init__.py)", "errorType": "Runtime.ImportModuleError" } Also tried https://gist.github.com/allen-munsch/ad8faf9c04b72aa8d0808fa8953bc639: { "errorMessage": "Unable to import module 'lambda_function': cannot import name 'etree' from 'lxml' (/var/task/lxml-4.3.4-py3.6-linux-x86_64.egg/lxml/__init__.py)", "errorType": "Runtime.ImportModuleError" } I am running on Ubuntu 18.04 on

Unable to import lxml etree on aws lambda

纵然是瞬间 提交于 2020-01-05 06:27:09
问题 { "errorMessage": "Unable to import module 'lambda_function': cannot import name 'etree' from 'lxml' (/var/task/lxml/__init__.py)", "errorType": "Runtime.ImportModuleError" } Also tried https://gist.github.com/allen-munsch/ad8faf9c04b72aa8d0808fa8953bc639: { "errorMessage": "Unable to import module 'lambda_function': cannot import name 'etree' from 'lxml' (/var/task/lxml-4.3.4-py3.6-linux-x86_64.egg/lxml/__init__.py)", "errorType": "Runtime.ImportModuleError" } I am running on Ubuntu 18.04 on

Error on Lex Bot console - Reached second execution of fulfillment lambda on the same utterance

孤人 提交于 2020-01-05 05:45:10
问题 I created a bot in Lex and then created two intents within same bot - intent1 and intent2 with utterance get me a taxi now and I wan a taxi to {Location} on {TravelDate} at {TaxiTime} respectively(first one in intent1 and second one in intent2 ). Both the intents call different lambda function and inside lambda functions I access RDS to add the booking info for taxi. When I test from Lex console by saying either of the two utterances the lambda function executes completely as I can see

Giving AWS Api Gateway Permission To Invoke Lambda Function using BOTO3

 ̄綄美尐妖づ 提交于 2020-01-05 05:36:10
问题 I am attempting to use BOTO3 to create an Api Gateway method that invokes a lambda function. I have so far been unable to find how to grant the necessary permissions. Curiously, setting the lambda method name manually through the AWS console sets up permissions automatically. I have been unable to replicate this in code. This is the code I am using to set up the gateway: # Create a rest api self.rest_api = self.apigateway.create_rest_api( name='AWS_CMS_Operations' ) # Get the rest api's root