aws-lambda

Is it possible to keep an AWS Lambda function warm?

穿精又带淫゛_ 提交于 2020-12-01 09:24:06
问题 There are a few pieces of my app that cannot afford the additional 1-2 second delay caused by the "freeze-thaw" cycle that Lambda functions go through when they're new or unused for some period of time. How can I keep these Lambda functions warm so AWS doesn't have to re-provision them all the time? This goes for both 1) infrequently-used functions and 2) recently-deployed functions. Ideally, there is a setting that I missed called "keep warm" that increases the cost of the Lambda functions,

Attempting to decrypt ciphertext within a Lambda function using KMS results in timeout

孤人 提交于 2020-11-30 03:12:04
问题 When decrypting ciphertext from the command line using the AWS CLI, the ciphertext gets decrypted without issues: $ aws kms decrypt --ciphertext-blob fileb://encrypted-secrets --output text --query Plaintext --region us-east-1 | base64 --decode > decryped-secrets This decryption operation also works locally when attempting to do so from a js script: #!/usr/local/bin/node const fs = require('fs'); const AWS = require('aws-sdk'); const kms = new AWS.KMS({region:'us-east-1'}); const secretPath =

Attempting to decrypt ciphertext within a Lambda function using KMS results in timeout

|▌冷眼眸甩不掉的悲伤 提交于 2020-11-30 02:56:17
问题 When decrypting ciphertext from the command line using the AWS CLI, the ciphertext gets decrypted without issues: $ aws kms decrypt --ciphertext-blob fileb://encrypted-secrets --output text --query Plaintext --region us-east-1 | base64 --decode > decryped-secrets This decryption operation also works locally when attempting to do so from a js script: #!/usr/local/bin/node const fs = require('fs'); const AWS = require('aws-sdk'); const kms = new AWS.KMS({region:'us-east-1'}); const secretPath =

librosa.load gives error "module 'soundfile' has no attribute 'SoundFile'

十年热恋 提交于 2020-11-29 21:09:16
问题 I have deployed librosa, matplotlib and all its required dependencies using AWS-Lambda-layers and it's working fine. When I send a .wav file from postman using the binary format the librosa.load() gives me the following error { "errorMessage": "module 'soundfile' has no attribute 'SoundFile'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 83, in lambda_handler\n clip, sample_rate = librosa.load(file_name)\n", " File \"/opt/python/librosa/core

librosa.load gives error "module 'soundfile' has no attribute 'SoundFile'

回眸只為那壹抹淺笑 提交于 2020-11-29 21:06:50
问题 I have deployed librosa, matplotlib and all its required dependencies using AWS-Lambda-layers and it's working fine. When I send a .wav file from postman using the binary format the librosa.load() gives me the following error { "errorMessage": "module 'soundfile' has no attribute 'SoundFile'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 83, in lambda_handler\n clip, sample_rate = librosa.load(file_name)\n", " File \"/opt/python/librosa/core

librosa.load gives error "module 'soundfile' has no attribute 'SoundFile'

醉酒当歌 提交于 2020-11-29 21:06:26
问题 I have deployed librosa, matplotlib and all its required dependencies using AWS-Lambda-layers and it's working fine. When I send a .wav file from postman using the binary format the librosa.load() gives me the following error { "errorMessage": "module 'soundfile' has no attribute 'SoundFile'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 83, in lambda_handler\n clip, sample_rate = librosa.load(file_name)\n", " File \"/opt/python/librosa/core

Promise: Then before Resolve

我的梦境 提交于 2020-11-29 10:40:30
问题 Very first thing I've ever done in Node.js, I'm writing an AWS Lambda function, and I want to check whether a custom attribute on a User has a value before doing anything else. Since I'm told Promises are the way to handle asynchronous methods synchronously, I wrote the function: var AWS = require('aws-sdk'); var s3 = new AWS.S3(); var cogId = new AWS.CognitoIdentityServiceProvider(); exports.handler = function (event, context) { if (event != null) { var identityId = context.identity

Promise: Then before Resolve

╄→尐↘猪︶ㄣ 提交于 2020-11-29 10:40:30
问题 Very first thing I've ever done in Node.js, I'm writing an AWS Lambda function, and I want to check whether a custom attribute on a User has a value before doing anything else. Since I'm told Promises are the way to handle asynchronous methods synchronously, I wrote the function: var AWS = require('aws-sdk'); var s3 = new AWS.S3(); var cogId = new AWS.CognitoIdentityServiceProvider(); exports.handler = function (event, context) { if (event != null) { var identityId = context.identity

Lambda error “TypeError: 'str' object does not support item assignment Traceback”

若如初见. 提交于 2020-11-29 09:57:04
问题 I am trying out import json import uuid import boto3 def lambda_handler(event, context): dynamo_client = boto3.resource('dynamodb') loadeo_carrier_company = dynamo_client.Table('loadeo_carrier_company') item = {} item = event['body'] print(item) item['company_id'] = str(uuid.uuid4()) print (type(item)) try: loadeo_carrier_company.put_item( Item=item ) return { "statusCode": 200, "headers" : { "Access-Control-Allow-Origin" : "*" }, "message": json.dumps("Record has been inserted"), "body":

Lambda error “TypeError: 'str' object does not support item assignment Traceback”

若如初见. 提交于 2020-11-29 09:56:44
问题 I am trying out import json import uuid import boto3 def lambda_handler(event, context): dynamo_client = boto3.resource('dynamodb') loadeo_carrier_company = dynamo_client.Table('loadeo_carrier_company') item = {} item = event['body'] print(item) item['company_id'] = str(uuid.uuid4()) print (type(item)) try: loadeo_carrier_company.put_item( Item=item ) return { "statusCode": 200, "headers" : { "Access-Control-Allow-Origin" : "*" }, "message": json.dumps("Record has been inserted"), "body":