Questions tagged [lambda]

17126 questions
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
811

Views

Computing the difference between first and last values in a rolling window

I am using the Pandas rolling window tool on a one-column dataframe whose index is in datetime form. I would like to compute, for each window, the difference between the first value and the last value of said window. How do I refer to the relative index when giving a lambda function? (in the bracket...
Pandora
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
2

answer
555

Views

C# Create Lambda Expression Dynamically

I work with Dapper and I try to create auto-mapped method for inner join. This is the example of the models: public class User { public long IdUser { get; set; } public string Email { get; set; } } public class Page { public long Id { get; set; } public string Name { get; set; } public long IdUserC...
Fabrizio Pairone
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
114

Views

New Feature Lambda Overloading in Java [duplicate]

This question already has an answer here: Java 8 Lambda expression - Method overloading doubts 6 answers I'm a little bit confused about why there is no such thing like lambda overloading. I know lambda expression work with @FunctionalInterface If you have two or more abstract method in interface t...
Azeem Haider
0

votes
2

answer
29

Views

Why lambdas passed as argument cannot redefine variable internally [duplicate]

This question already has an answer here: Variable is already defined in method lambda 5 answers Why the Java Compiler don't allow us to create a homonymous variable in the function's local scope when we are passing a lambda as an argument? import java.util.*; import java.util.function.*; public cl...
Bruno Carneiro
1

votes
1

answer
47

Views

How to invoke a generic function inside another function with a timeout with java 8?

I have a function that gives me a state of service: public ServiceState getServiceState(){ return someService().getState(); //currently state return 'NOTACTIVE' } And when I invoke a certain method on the system, the service should be in active state after x amount of time (unknown time): someServi...
totothegreat
1

votes
2

answer
74

Views

Java 8 expression fill list from list with another list inside

I'm trying to reach a lambda expression avoiding doing this: for (OrderEntity o: onEntryL) { for(GeoFenceEventEntity g: o.getGeoFenceEvent()){ if(null != g.getEndAt() && g.getDynamoGeofenceType().equalsIgnoreCase('WAREHOUSE')){ //all of them, get data } } } And on Lambda trying something like this (...
Elí Giacomelli
1

votes
3

answer
111

Views

How to convert the following code to Java 8 streams and lambdas

I have a complicated requirement where a list records has comments in it. We have a functionality of reporting where each and every change should be logged and reported. Hence as per our design, we create a whole new record even if a single field has been updated. Now we wanted to get history of co...
diwakarb
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
41

Views

ActionListener implementation with lambda expression doesn't work invoked by a Timer

I am reading the book [Core Java Vol 1] 10th edition and in chapter 6 section 6.3.6 there is a code snippet for explaining 'Variable Scope' in lambda expression.I ran this code on my own and it just terminated immediately and not showing 'Hello' every 2 seconds as expected in console log. I am using...
Ni Yilun
1

votes
3

answer
31

Views

Remove outliers from Pandas pivot_table rows

I am currently working on a problem that entails looking at a number of purchased parts and determining if we are successful in our endeavors to reduce our cost. I am hit by a few issues though. Since our purchaser can choose to enter an order in any given number of Unit Of Measures (UOM), but does...
Henrik Poulsen
1

votes
2

answer
111

Views

Fibonacci using Stream And BinaryOperator in Java

I'm student and I learning functional Java 8. I got project to do and I don't understand how this function interface work. My teacher told me 'you should know that' and I'm looking for help to understand this problem. It should count Fibonacci series I got this code StreamUtils.generateRest(Stream.o...
anik
1

votes
2

answer
14

Views

Last imported file overwrites statements from previous files. Better ways of specifying imported variables?

Hey stackoverflow community, i’m new to this forum and to python developing in general and have a problem with Alexa/ Python overriding the similar named variable from different files. In my language learning skill I want Alexa to specifically link a “start specific practice” intent from the...
Belongings
1

votes
5

answer
59

Views

How do I append a lambda to a list in python?

I am trying to make a program that creates a list of lambda functions of the format y=mx+b, where 'm' and 'b' are predetermined values My overall goal is to implement a function that Takes a picture Finds the lines on it Extends them across the whole picture in a solid colour Basically, something l...
Kei
1

votes
1

answer
27

Views

How to pass lambda function in a c++ functor?

I am pretty new at Rccp and Rccpparallel and I have trouble figuring out where I made mistake. So I want to create a function that do a power element wise in a matrix in parallel. I am following rcppParallel examples. On one core the code compiles and works fine, but when I try to pass n to functor...
JacobJacox
1

votes
3

answer
48

Views

instantiation of variables in body of lambda

I write all the rules of lambda expression, but I have a doubt about it. When to use lambda A lamda expression is used only to override an abstract method of a functional interface. Not to override methods of concrete classes, abstract classes or not functional interfaces. Infact in all these cases...
Adryr83
1

votes
1

answer
22

Views

How to find Exact String match using Lambda function while comparing frozen sets?

While following this answer by @adrtam. I tried to find exact match for line using A) print(rules[rules['antecedents'].apply(lambda x: 'line' in x)]) and B) print(rules[rules['antecedents'].apply(lambda x: 'line' == x)]) C) print(rules[rules['antecedents'].apply(lambda x: 'line' == str(x))]) A retur...
raakshasan
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
1

answer
62

Views

Do mutable lambdas have their own copies of captured values?

std::function create_function (args...) { int x = initial_value (args...); return [x] () mutable { std::cout
spraff
1

votes
2

answer
73

Views

How to define template parameters for a generic lambda argument? [duplicate]

This question already has an answer here: Constructing std::function argument from lambda 1 answer Explanation: CLion and it's standard compiler give me an error that the 'candidate template [is] ignored', when I write a lambda as parameter for a generic function that takes a lambda as argument. Th...
Lyras
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
2

votes
3

answer
31

Views

Convert DataTable into a Dictionary using Linq/Lambda

I have a DataTable that I would like to convert into dictionary in C# for my project. I can use the traditional way of programming to achieve the goal but it is not as elegant as using linq/lambda. I tried to use Lambda but I got stuck in how to flatten multiple rows into 1. I have a mock DataTable...
user1205746
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
24

votes
2

answer
1.4k

Views

Capturing a lambda in another lambda can violate const qualifiers

Consider the following code: int x = 3; auto f1 = [x]() mutable { return x++; }; auto f2 = [f1]() { return f1(); }; This will not compile, because f1() is not const, and f2 is not declared as mutable. Does this mean that if I have a library function that accepts an arbitrary function argument and ca...
riv
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
0

votes
0

answer
17

Views

Lambdas, Is this keyword needed to disambiguate const/non-const member functions?

When I use MSVC to compile this program, I receive the error, 'Example::bar ambiguous call to overloaded function' Then, I found that the this keyword was able to resolve the error. Surprised, I used rextester and found that both Clang and GCC were able to compile the program without the this keywo...
Rabster
0

votes
1

answer
47

Views

How can I Tell if a Type is a Functor? [duplicate]

This question already has an answer here: Find out whether a C++ object is callable 8 answers Can std::is_invocable be emulated within C++11? 1 answer In c++17 I have is_invocable to match function pointers, lambdas, and functors. But what if I'm trapped on c++14? Do I have a type trait, or can I...
Jonathan Mee
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
2

Views

Combine Consumers with different arguments or different arguments number

Let's say, our method receives input String and returns some List output. This output is the result of some number of generators, some of which depend on input and some of them not - they just add predefined values. I want to implement these generators like a list of some function interfaces (Consu...
Aleksey Balenko
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
-1

votes
1

answer
24

Views

C#: Generic method expression with unknown signature

For example we have a generic method public void Test(T param, Action callback) { } If call this method with some parameter, it automatically detect the type of T and we don't need to declare it explicitly. For example: // here 'int' detected Test(1, (intVariable) => { }); // here 'string' detected...
Grigor Aleksanyan
0

votes
2

answer
25

Views

Scala Spark RDD Aggregate behaves weirdly

I have 2 seqOp functions given to aggregate which I expect to return identical results. They don't. This version works: rdd.aggregate(0)((acc, article) => (acc + (if (article.mentionsLanguage(lang)) 1 else 0)), _ + _) This version doesn't work: def seqOp(acc: Int, article: WikipediaArticle): Int = {...
Atte Juvonen
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

View additional questions