aws-lambda

How to create a new version of a Lambda function using CloudFormation?

做~自己de王妃 提交于 2019-12-17 22:38:34
问题 I'm trying to create a new version of a Lambda function using CloudFormation. I want to have multiple versions of the same Lambda function so that I can (a) point aliases at different versions - like DEV and PROD - and (b) be able to roll back to an earlier version This is the definition of my Lambda version: LambdaVersion: Type: AWS::Lambda::Version Properties: FunctionName: Ref: LambdaFunction A version gets created when running "aws cloudformation create-stack" but the subsequent "aws

Creating a lambda function in AWS from zip file

与世无争的帅哥 提交于 2019-12-17 21:46:54
问题 I am trying to create a simple lambda function, and I'm running into an error. My code is basically console.log('Loading function'); exports.handler = function(event, context) { console.log('value1 =', event.key1); console.log('value2 =', event.key2); console.log('value3 =', event.key3); context.succeed(event.key1); // Echo back the first key value // context.fail('Something went wrong'); } in a helloworld.js file. I zip that up and upload it as a zip file in the creating a lambda function

aws api gateway & lambda: multiple endpoint/functions vs single endpoint

三世轮回 提交于 2019-12-17 21:46:33
问题 I have an AWS api that proxies lamba functions. I currently use different endpoints with separate lambda functions: api.com/getData --> getData api.com/addData --> addData api.com/signUp --> signUp The process to manage all the endpoints and functions becomes cumbersome. Is there any disadvantage when I use a single endpoint to one lambda function which decides what to do based on the query string? api.com/exec&func=getData --> exec --> if(params.func === 'getData') { ... } 回答1: It's

Python request in AWS Lambda timing out

倾然丶 夕夏残阳落幕 提交于 2019-12-17 21:03:16
问题 I'm trying to make a http request from my AWS Lambda but it times out. My code looks similiar to this: import requests def lambda_handler(event, context): print('Im making the request') request.get('http://www.google.com') print('I recieved the response') But when I test this, I get a timeout. The output is Im making the request END RequestId: id REPORT RequestId: id Duration: 15003.25 ms Billed Duration: 15000 ms Memory Size: 128 MB Max Memory Used: 18 MB 2016-04-08T20:33:49.951Z id Task

How to troubleshoot this AWS lambda error - An error has occurred: Received error response from Lambda: Unhandled?

南笙酒味 提交于 2019-12-17 20:55:37
问题 I'm new to AWS. I'm build chatbot using aws lex and aws lambda c#. I'm using sample aws lambda C# program namespace AWSLambda4 { public class Function { /// <summary> /// A simple function that takes a string and does a ToUpper /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public string FunctionHandler(string input, ILambdaContext context) { try { return input?.ToUpper(); } catch (Exception e) { return "sorry i could not process

Amazon S3 triggering another a Lambda function in another account

狂风中的少年 提交于 2019-12-17 20:02:10
问题 I want to run a lambda in Account B when any object comes into Account A S3 bucket. But I heard that we can access Lambda from the same account S3 only, for cross-account S3 Lambda access I must run Lambda within same account and make another trigger which runs another account Lambda: S3(Account A)--> Lambda(Account B)- not possible S3(Account A)--> Lambda(Account A)-->Lambda(Account B)- Possible Can someone help me which option is possible? If so how? 回答1: @John's Solution works but there

_multiprocessing.SemLock is not implemented when running on AWS Lambda

瘦欲@ 提交于 2019-12-17 17:57:10
问题 I have a short code that uses the multiprocessing package and works fine on my local machine. When I uploaded to AWS Lambda and run there, I got the following error (stacktrace trimmed): [Errno 38] Function not implemented: OSError Traceback (most recent call last): File "/var/task/recorder.py", line 41, in record pool = multiprocessing.Pool(10) File "/usr/lib64/python2.7/multiprocessing/__init__.py", line 232, in Pool return Pool(processes, initializer, initargs, maxtasksperchild) File "/usr

AWS Lambda import module error in python

痴心易碎 提交于 2019-12-17 17:42:11
问题 I am creating a AWS Lambda python deployment package. I am using one external dependency requests . I installed the external dependency using the AWS documentation http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html. Below is my python code. import requests print('Loading function') s3 = boto3.client('s3') def lambda_handler(event, context): #print("Received event: " + json.dumps(event, indent=2)) # Get the object from the event and show its content

Amazon Kinesis & AWS Lambda Retries

家住魔仙堡 提交于 2019-12-17 17:40:09
问题 I'm very new to Amazon Kinesis so maybe this is just a problem in my understanding but in the AWS Lambda FAQ it says: The Amazon Kinesis and DynamoDB Streams records sent to your AWS Lambda function are strictly serialized, per shard. This means that if you put two records in the same shard, Lambda guarantees that your Lambda function will be successfully invoked with the first record before it is invoked with the second record. If the invocation for one record times out, is throttled, or

AWS Lambda API gateway with Cognito - how to use IdentityId to access and update UserPool attributes?

烂漫一生 提交于 2019-12-17 17:33:48
问题 OK I am now days into this and have made significant progress but am still completely stumped about the fundamentals. My application uses Cognito User Pools for creating and managing users - these are identified on S3 it seems by their IdentityId. Each of my users has their own S3 folder, and AWS automatically gives them a folder name that is equal to the user's IdentityId. I need to relate the IdentityId to the other Cognito user information but cannot work out how. The key thing I need is