aws-lambda

Connect Lambda to Redshift in Different Availability Zones

北慕城南 提交于 2019-12-18 09:37:12
问题 Our Redshift cluster resides in Zone A. When our Lambda function uses a Zone A subnet, it can connect to Redshift. When our Lambda function uses a subnet other than Zone A, it times out. The work around, where we ALLOW connections for Redshift on port 5439 from 0.0.0.0/0, is not desired. We have our Lambda functions and Redshift cluster in the same VPC. Lambda functions have 4 dedicated subnets (one per zone) Redshift has 4 dedicated subnets per zone as well Lambda functions have their own

Serverless Framework with AWS cognito generates CORS error

霸气de小男生 提交于 2019-12-18 09:32:50
问题 I get this error message from the Angular frontend and I am not authorized to touch my lambda code: `Access to fetch at 'https://testapicd.***.***.com/localization/v1/role' from origin 'https://localization.test.***.***.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.` I have looked everywhere and there seems

Node.js Lambda function returns “The response is invalid” back to Alexa Service Simulator from REST call

て烟熏妆下的殇ゞ 提交于 2019-12-18 09:14:03
问题 Having issues making a REST call to an API between a node.js Lambda function and Alexa. I'm using the request library to make the calls with an account linked skill. I've only set one sample utterance for the intent, and the simulator see this fine. Also, the cloudwatch logs show a 200 response code from the api endpoint and any of the returned data from the API from console.logs to CW. 'use strict'; var http = require('http'); var request = require('request'); var Alexa = require('alexa-sdk'

Conecting AWS Lambda to Redshift - Times out after 60 seconds

痞子三分冷 提交于 2019-12-18 05:56:12
问题 I created an AWS Lambda function that: logs onto Redshift via JDBC URL runs a query Locally, using Node, I can successfully connect to the Redshift instance via JDBC, and execute a query. var conString = "postgresql://USER_NAME:PASSWORD@JDBC_URL”; var client = new pg.Client(conString); client.connect(function(err) { if(err) {
 console.log('could not connect to redshift', err);
 } 
 // omitted due to above error However, when I execute the function on AWS Lambda (where it's wrapped in a async

Access denied on aws lambda function when getObject from S3 bucket

纵饮孤独 提交于 2019-12-18 05:22:35
问题 I'm using the default code for a lambda function: console.log('Loading function'); var aws = require('aws-sdk'); var s3 = new aws.S3({ apiVersion: '2006-03-01' }); exports.handler = function(event, context) { //console.log('Received event:', JSON.stringify(event, null, 2)); // Get the object from the event and show its content type var bucket = event.Records[0].s3.bucket.name; var key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' ')); var params = { Bucket: bucket, Key:

Scrapy throws error ReactorNotRestartable when runnning on AWS Lambda

青春壹個敷衍的年華 提交于 2019-12-18 04:25:15
问题 I have deployed a scrapy project which crawls whenever an lambda api requests comes. It runs perfectly for the first api call but later on it fails and throws ReactorNotRestartable error. As far as I can understand the AWS Lambda ecosystem is not killing the process, hence reactor is still present in the memory. The lambda log error is as follows: Traceback (most recent call last): File "/var/task/aws-lambda.py", line 42, in run_company_details_scrapy process.start() File "./lib/scrapy

FFmpeg transcoding on Lambda results in unusable (static) audio

余生长醉 提交于 2019-12-18 04:23:35
问题 I'd like to move towards serverless for audio transcoding routines in AWS. I've been trying to setup a Lambda function to do just that; execute a static FFmpeg binary and re-upload the resulting audio file. The static binary I'm using is here. The Lambda function I'm using in Python looks like this: import boto3 s3client = boto3.client('s3') s3resource = boto3.client('s3') import json import subprocess from io import BytesIO import os os.system("cp -ra ./bin/ffmpeg /tmp/") os.system("chmod -R

Serverless Framework - Python and Requirements.txt

我是研究僧i 提交于 2019-12-18 04:01:58
问题 Using the serverless framework v1.0.0, I have a 'requirements.txt' in my service root with the contents being the list of dependant python packages. (e.g. requests). However my resulting deployed function fails as it seems these dependencies are not installed as part of the packaging 'Unable to import module 'handler': No module named requests' I assume it is serverless that does the pip install, but my resulting zip file is small and clearly its not doing it, either by design or my fault as

How to access user's email address in Cognito Federated Identities?

南楼画角 提交于 2019-12-18 03:56:45
问题 I'm trying to set up a basic website (serverless on AWS) that would allow visitors to login with Google and/or Facebook. Currently I'm planning to use S3, Cognito with Federated Identities, API Gateway, Lambda (NodeJS), with DynamoDB. The client app will be using Angular. I have the social login with Google and Facebook working, and currently I am inserting a row in a "users" table when a user logs in the first time that includes the cognitoId, name, profile picture URL, etc. I also figure it

How does AWS Lambda serve multiple requests?

那年仲夏 提交于 2019-12-18 03:54:30
问题 How does AWS Lambda serve multiple requests? I want to know is it a multi-thread kind of a model here as well? If I am calling a Lambda from an API gateway. And there are 1000 requests in 10 secs to the API. How many containers will be created and how many threads. 回答1: How does AWS Lambda serve multiple requests? Independently. I want to know is it a multi-thread kind of a model here as well? No, it is not a multi-threaded model in the sense that you are asking. Your code can, of course, be