Questions tagged [aws-lambda]

1

votes
2

answer
1.3k

Views

AWS Lambda boto3: Filter Instances by Launch Time = today

I'm trying to automatically backup my EC2 instances through AWS Lambda. I used these 2 scripts and they work just fine. https://gist.github.com/bkozora/724e01903a9ad481d21e https://gist.github.com/bkozora/d4f1cf0e5cf26acdd377 But I would like to add the functionality that the scripts only delete or...
T. Moser
1

votes
1

answer
416

Views

How to specfiy existing FunctionName on SAM Template

I'm trying to deploy AWS Lambda function by using SAM. What I want to do is to update exsiting lambda function by deploying local source code. In order to do that, I specified the existing lambda function name as 'FunctionName' in template.yaml like below. However, 'FunctionName' does only support f...
Tamajin
1

votes
2

answer
1.4k

Views

Downgrade to previous version of AWS Lambda

Working with Amazon Lambda functions I use versioning feature which is provided by AWS Lambda functionality. Each time when I deployed new version of my artifact to AWS I create new version of function and publish it (using popup from screenshot). But how can I publish any previous version of my fun...
Gleb Kosteiko
1

votes
1

answer
925

Views

Terraform AWS S3 to Lambda Notification Trigger

I am trying to codify lambda function to be triggered using S3. Creation of Lambda function is successful, but the 'aws_s3_bucket_notification' resource fails at terraform:apply with MethodNotAllowed error with status code 405 : Error: Error applying plan: 20-Sep-2018 15:23:53 1 error(s) occurred...
Samarth
1

votes
1

answer
118

Views

Node ImageMagick succeed locally but fails in AWS Lambda

I'm using this Node ImageMagick for validating images via converting them in AWS Lambda function. Locally I have no problem, but when I deploy my function I get the error no decode delegate for this image format on some images only: { Error: Command failed: convert: no decode delegate for this image...
Lee Moe
1

votes
1

answer
46

Views

amazon load balancer for lambda

I am new to use aws. Normally, I use load balance like bottom with 2 servers. For L4 Load balancing, there are more than 2 servers But ALB - Lambda is not I think I am curious about ALB - Lambda relationship Is it 1:1? not like L4 switch? or VPCs stand for the server? And I want to know benefit to u...
USER
1

votes
3

answer
196

Views

How to run python code on AWS lambda with package dependencies >500MB?

The requirement is that I have to trigger a SageMaker endpoint on lambda to get predictions(which is easy) but have to do some extra processing for variable importance using packages such as XGBoost and SHAP. I am able to hit the endpoint and get variable importance using the SageMaker Jupyter noteb...
Tanmay Dhyani
1

votes
1

answer
37

Views

AWS lambda and external libraries

During my preparation to AWS certification I found the following question on various mock-exam resources (the description is slightly re-formulated in order not to violate legal rules): We have a lambda function which uses some external libraries (which are not part of standard Lambda libraries). Ho...
Andremoniy
1

votes
2

answer
29

Views

Reference resource in CloudFormation template in inline code property of a Lambda function

I have a CloudFormation template that has a Lambda function resource that is triggered by a CloudWatch event when a new AMI is registered. In the Lambda resource block, I pass my inline code in the Code property. The function triggers an SSM automation document execution if the AMI id is the desired...
dmn0972
0

votes
0

answer
8

Views

AWS LambdaLogger - FULL Java stack trace log to CloudWatch? (not just including i.e: java.lang or com.amazonaws)

Whenever my Amazon AWS Lambda logs (using LambdaLogger) an Exception to its CloudWatchLogs, there is either no stack trace (just the Exception itself) or the stack trace does not include my Lambda's custom Java code from where the Exception was thrown. How can I get my AWS Lambda (in uploaded JAR) t...
cellepo
0

votes
1

answer
11

Views

AWS ALB returns 502 Bad Gateway when return audio buffer from Lambda in nodejs

I have a lambda function which does returns audio buffer in response, when I invoke lambda from code it works fine but when I Call lambda behind ALB ,I get error 502 Bad Gateway. // Lambda function handler 'use strict'; module.exports.handler = async (event, context) => { // ALB expects following re...
Dharam
1

votes
1

answer
86

Views

Upload Image into S3 bucket using Api Gateway, Lambda funnction

I'm trying to upload the image (base64) from the postman, I can see when I hit the Serverless API, something has been added in S3 bucket but not image, I'm using nodejs Lambda function, I tried so many solutions but that didn't work out. Please suggest me where I'm wrong: const AWS = require('aws-sd...
Nasreen Ustad
1

votes
1

answer
10

Views

sqlite3 error on AWS lambda with Python 3.6

I try to run a lambda function on python3.6. I got the following error message: sqlite3 module is required for the SqliteCache: RuntimeError What confused me is that sqlite3 is a default module in python3, so how to install sqlite3? I tried python3 -m pip install python3 -t ./. It will failed
Yang L
0

votes
0

answer
3

Views

Jquery .post error in Amazon aws-execute serverless app

I am trying to setup this self-destruct-o app I found using the instructions provided on github. I have it on my endpoint (https://n526t325k7.execute-api.us-east-1.amazonaws.com/dev), but there is a 500 error at a $.post call. I have seen some issues with Jquery using API Gateway, but this app doesn...
nick
0

votes
0

answer
3

Views

How can I automatically spin up my ec2 instance, run a command and then shut it down?

I want to run a machine learning model on my data in redshift postgres database once a week. I set up my R script as a rest api using plumbr and then I set it up to be managed as a task by pm2. I have it so the task starts up when the ec2 instance starts up and then keeps running. All I need to do t...
goollan
1

votes
0

answer
8

Views

I am trying to get individual attributes from a DynamoDB table and turn them into variables before callback

I am trying to get individual attributes from a DynamoDB table and turn the into variables before callback. I want to callback an Html with the attributes as variables inside the Html document, but I only managed to callback either the whole Item, or a few specific attributes with 'ProjectionExpress...
Adpy
1

votes
2

answer
574

Views

Add trigger to AWS Lambda Function using Java API

How can I add new trigger for existing AWS Lambda function using Java API? I would like to add CloudWatch Events - Schedule trigger. It looks like I should use AmazonCloudWatchEventsClient. How can I set the credentials for the client? Any examples will be appreciated. Thanks.
Alex Broitman
1

votes
0

answer
9

Views

putBotAlias not working in AWS LexModelBuildingService node.js

I've been trying to replace the existing LexBot Alias(named LATEST) with a newly created bot version. Now, according to aws documentation When you want to update a bot alias, set the checksum field to the checksum of the most recent revision of the $LATEST version. I can see the Alias LATEST is usin...
Salim Shamim
1

votes
3

answer
625

Views

Calling getItem() on DynamoDB object from AWS Lambda, why doesn't my callback execute?

I'm trying to get an item from my DynamoDB database. The way my code is presently written, I fail to retrieve any data from DynamoDB. I must be doing something wrong, because as far as I can tell from my test, my callback is not being called. I spent all day on this yesterday and have been tinkering...
Kevin Glick
1

votes
2

answer
2.1k

Views

How to trigger a Lambda function at specific time in AWS?

I am aware of the CloudWatch recurring events that can be used to run Lambda recurringly.. but is there a way that I can trigger it on a certain time and not repeat?
Faizuddin Mohammed
1

votes
2

answer
501

Views

Amazon Lambda list running functions

How can I check the running Lambda functions running using the aws cli? It seems that there is no a command to check it: aws lambda XXXX I have several scripts running, and I'd like to monitor the situation. It is enough to show how many functions are running. Thank you
J.R.
1

votes
1

answer
224

Views

Is promise wrapper necessary around lambda.invoke?

I have the following Promise.all example. Is the promise wrapper necessary with lambda.invoke? Referenced this thread function get1(id) { return new Promise((resolve, reject) => { const params = { FunctionName: 'myLambda', // the lambda function we are going to invoke InvocationType: 'RequestRes...
Rod
1

votes
3

answer
233

Views

How can I automate the end-to-end testing of my serverless web app?

So my app stack looks like this in prod: Backend: AWS API Gateway + Lambda + DynamoDB + ElastiCache(redis) Backend - algo: Long running process - dockerized Java app running on ECS (Fargate) Frontend: Angular app, served from S3 I'd like to use https://www.cypress.io/ for end-to-end tes...
Force Hero
1

votes
1

answer
929

Views

install python package at current directory

I am mac user, used to run pip install with --user, but recently after brew update, I found there are some strange things, maybe related. Whatever I tries, the packages are always installed to ~/Library/Python/2.7/lib/python/site-packages Here are the commands I run. $ python -m site --user-site ~/...
Bill
1

votes
1

answer
86

Views

How to get the YesIntent run after a specific intent is run in Alexa Skill

I've been trying to find out how to make the AMAZON.YesIntent run after another intent is triggered. I have searched around and tried different solutions however they never work.
Yuri Alves
1

votes
1

answer
184

Views

AWS GET request with body rejected by CloudFront

I'm build an API using AWS SAM (Lambda & API Gateway) whose contract is defined by a 3rd party. The 3rd party calls my API with a GET request that contains JSON in the body. However, when a request is sent to the API with a body it gets rejected by CloudFront. This is the request: curl -X GET -H 'Co...
Stefan Moser
1

votes
1

answer
334

Views

How to map querystring and header to AWS C# lambda function parameter

I have AWS Gateway REST API that takes 2 querystring parameters https://xxxxxx.xxxx.us-east-1.amazonaws.com/dev/pets?type=dog&page=1 The caller of the API also include x-api-key in the header. I want API gateway to pass querystring parameters and x-api-key to lambda function. So in AWS API Gateway C...
LP13
1

votes
1

answer
99

Views

Create and upload a file in S3 using Lambda function

I am writing a Lambda function to create a text file and upload to a specific S3 directory. import boto3 import os def lambda_handler(event, context): src_bucket = event['Records'][0]['s3']['bucket']['name'] filepath = event['Records'][0]['s3']['object']['key'] head, tail = os.path.split(filepath) n...
Raj
1

votes
2

answer
202

Views

In nodejs, can I have sub-folders that each sub-folder host a AWS lambda function?

I am trying to implement a serverless application on AWS. I wish to know a good way to organize my codes. Let's say, I want to have multiple lambda functions to be organized under a git repo, each lambda function and it's associated codes are in its own sub-folder. This is what I have tried, separa...
GreenLake4964
1

votes
2

answer
167

Views

Micronaut serverless application using DynamoDB and Graal custom runtime throws Cannot construct instance of com.amazonaws.partitions.model.Partitions

SAMPLE PROJECT AVAILABLE HERE: https://github.com/codependent/micronaut-aws-lambda-proxy-graal I have a Micronaut application deployed on Amazon AWS as a Lambda function. It is compiled into a GraalVM native image and run using an AWS Lambda Custom Runtime. If the application doesn't use DynamoDB it...
codependent
0

votes
1

answer
69

Views

Service to service workflow with AWS cognito and AWS Lambda

I'm rather new to AWS Cognito and AWS Lambda. So far I've played around with Serverless and deployed my REST API via AWS Lambda. However, I would like to make my API available for several external parties. As this is service to service, there is no end user directly calling my API. I make the API a...
math
1

votes
1

answer
34

Views

Separating Environments in AWS

Is there a best practice around separating environments in AWS? I've got a solution that employs the following services: Lambda SNS SQS DyanmoDB API Gateway S3 IAM We're not live yet, but we're getting close. By the time we go-live, I'd like a proper production, test, and development environment wit...
Adam
1

votes
1

answer
38

Views

How to read AWS cognito custom attributes and logged in user in lambda

I have created a custom attributes inside aws congnito pool, now adding Post authentication lambda and inside of lambda want to read 'custom attributes' and loggedin username . Inside Node.js lambda : var email=event.request.userAttributes.email; var refNumber=event.request.userAttributes.ref_numb...
vaquar khan
1

votes
0

answer
3

Views

Using AWS API Gateway+Lambda Without It becoming a Dependency

There's no doubt to the benefits of API Gatway+Lambda for a micro-services. My concern is what would happen if we decide to move off API Gateway+Lambda to ECS/Fargate, or even another Cloud. There seems to be a consensus on using one Lambda function per route/action. I have some theories about how t...
Sam Hammamy
0

votes
0

answer
4

Views

Using Python Boto3 AWS Lambda, S3 Key LastModified returns in two types for two different ways

The LastModified of a given key returns in two different formats. If I store in a variable or directly print, it gives me this format: 2019-04-17 11:14:11+00:00 And If I try to store it as a value in a dict, and then print it, it shows in this format: {'redshift_data_source/grid/load.csv': datetim...
Aakash Basu
1

votes
0

answer
792

Views

Extract email attachment from SES into S3

I want to extract an email attachment and save that attachment into an S3 bucket. I have configured SES to intercept my incoming emails. I am guessing I need to create a SES rule which would have an action to trigger a Lambda function that extracts the email attachment and stores it to S3. I am not...
user1534235
1

votes
2

answer
592

Views

aws lambda didn't convert json request to POJO

I have a lambda function: package org.smarter.note; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.LambdaLogger; import com.amazonaws.services.lambda.runtime.RequestHandler; public class AddNoteRequestHandler implements RequestHandler { private Not...
Jakim
1

votes
1

answer
112

Views

Alexa ASK Lambda bug

I'm trying to make a skill where after the LaunchRequest, an initial welcome message is played in the function StartGame asking the user for their school, and then the user says their school in the SetSchool intent, and then the skill says a message. Right now there's a bug in the last part, and I d...
Neil Chowdhury
1

votes
1

answer
296

Views

AWS Lambda Versioning - How do I have two separate lambda alias in a production stage?

I have a mobile app that invokes an AWS Lambda say for e.g. 'Hello'. Let's assume that there is a change to the 'hello' lambda function and it's published to a new version 2. But this lambda function will be invoked by the mobile App version 2 and will be available to users who have updated the App....
Karthik Shivkumar
1

votes
2

answer
53

Views

Create a response for invalid and incomplete end points using the Serverless Framework?

I have a series of HTTP endpoints that involve lambda functions that hit detail information like so: products/1 users/1 package/998134 There is not a corresponding endpoint for products/, users/ or package/. I have a custom authorizer around the users/{id} and package/{id} endpoints. If a user goes...
Serverless Qs

View additional questions