aws-lambda

Unable to connect to S3 from Lambda/Python/Boto3 when VPC is enabled

孤人 提交于 2020-01-16 18:23:10
问题 I have a very simple python function in a lambda which runs fine if I leave VPC disabled. import json import boto3 import botocore def lambda_handler(event, context): s3 = boto3.client('s3', 'us-east-1', config=botocore.config.Config(s3={'addressing_style':'path'})) keys = [] resp = s3.list_objects_v2(Bucket='[BUCKET_NAME]') for obj in resp['Contents']: print(obj['Key']) return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } When VPC is enabled the S3 connection continually

AWS Lambda connecting to SQL with Python and pyodbc

旧街凉风 提交于 2020-01-16 16:56:09
问题 I have an AWS Lambda that I want to connect to my on prem SQL server to read and write data from\to. I am using Python and pyodbc. I have got pyodbc installed (compiled zip file in an S3 bucket added to the lambda through a layer), but when I try and run this code I get an odd error: import boto3 import pyodbc s3 = boto3.client('s3') def lambda_handler(event, context): # print(help(pyodbc)) server = "Server" database = "Database" username = "AWS-Lamdba-RO" password = "Password" cnxn = pyodbc

output http request node.js in aws lambda

谁说我不能喝 提交于 2020-01-16 16:47:29
问题 exports.handler = async (event) => { // TODO implement const https = require('https'); https.get('https://postman-echo.com/get?' + 'username =' + '&password =' + '&date=' + '&cashSales=' + + '&creditCardVisa=' + '&creditCardMaster=' + + '&creditCardAmex=' + '&creditCardOthers=0', res => { //console.log(res.statusCode); //console.log(res.headers); let body = ''; res.on('data', data => { body += data; }) res.on('end', () => console.log(body)); }) const response = { statusCode: 200, body: JSON

using slots in skill intent to search dynamodb

寵の児 提交于 2020-01-16 15:44:09
问题 I'm new to alexa, nodejs and coding in general but i am currently trying to create a skill to find machine states from my dynamodb table using date and time. I currently have set up my skill to get alexa and lambda to understand my slot values but im not sure how i can use these values for a dynamodb query and have alexa call out the state for that corresponding time My table is setup with a primary and sort key which are date and time and i have a third column for machine state. I'm not sure

Updating Lambda function to new runtime. Why is cURL no longer working in Node 10 on AWS Lambda?

冷暖自知 提交于 2020-01-16 12:00:09
问题 This is the line in my Lambda function that's raising an error: // running in Node 8 const { execSync } = require('child_process'); execSync('curl https://github.com'); I'm trying to upgrade my Lambda function from Node 8 to Node 10 or Node 12, since Node 8 on Lambda is being deprecated at the end of December, 2019 (so I won't be able to update it). However, when I dig into my CloudWatch logs I'm seeing the following error: bin/sh: curl: command not found And when I update my Lambda function

Echo Spot record video using inbuilt camera - Custom skill

冷暖自知 提交于 2020-01-16 02:02:32
问题 I have a requirement to record video using Amazon device. Currently, I have the Echo spot device and tried to find some way from which I can open the camera and start recording until I give the command to stop, using the custom skill. But didn't get the success. What I have gone through till now is: Alexa.CameraStreamController Interface By which I can handle the camera and Alexa.MediaMetadata Interface to handle recorded videos. But couldn't find anything useful. Can I use an inbuilt camera

AWS Lambda call Lambda

别等时光非礼了梦想. 提交于 2020-01-16 01:19:11
问题 I'm trying to call one Lambda function from another one that I have. I set up my permissions so that is not problem. My problem is that the function doesn't wait for the Invoke function to complete and return NULL all the time. Here is the code I'm using: const AWS = require('aws-sdk'); exports.handler = async (event, context, callback) => { var lambda = new AWS.Lambda({region: 'us-east-1', apiVersion: '2015-03-31'}); var params = { FunctionName: 'testFunction', InvocationType:

Why is my Lambda unable to access the internet?

时光怂恿深爱的人放手 提交于 2020-01-15 17:51:25
问题 I have a Lambda function which can be triggered from an API gateway or ALB request. I also have an RDS Aurora PostgreSQL instance, both of which are running within a VPC. I'm able to connect to the RDS instance from the Lambda just fine, however I can't access the internet, e.g. attempting to fire off a request to https://jsonplaceholder.typicode.com/todos/1 will cause a timeout. I also can't connect to the remote database using a SQL client such as DBeaver. Here's some detail below but let

Why is my Lambda unable to access the internet?

守給你的承諾、 提交于 2020-01-15 17:51:16
问题 I have a Lambda function which can be triggered from an API gateway or ALB request. I also have an RDS Aurora PostgreSQL instance, both of which are running within a VPC. I'm able to connect to the RDS instance from the Lambda just fine, however I can't access the internet, e.g. attempting to fire off a request to https://jsonplaceholder.typicode.com/todos/1 will cause a timeout. I also can't connect to the remote database using a SQL client such as DBeaver. Here's some detail below but let

TypeError : “errorMessage”: “argument should be a bytes-like object or ASCII string, not 'Binary'”,

佐手、 提交于 2020-01-15 15:08:05
问题 I tried another program to validate the saved list of username and encrypted password from the above table and username and allowed resources in a different table. This program needs to be integrated with API request, however I have changed to send event test parameters from lambda test config, I tried the same for decoding as guided in the previous comments. Based on the previous error and comments, I was able to resolve that. "errorMessage": "string argument without an encoding", TypeError: