AWS Lambda gets executed 3 times The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow to pass a querystring or route parameter to AWS Lambda from Amazon API GatewayCan an AWS Lambda function call anotherCan't add s3 notification for lambda using boto3AWS lambda function ConnectionError when configured with VPCAWS IoT and Lambda RuleAWS Lambda recursive invocation works too good?S3 copy inside lambda function timing outAWS Lambda Timeouts randomlyAWS node.js lambda request dynamodb but no response (no err, no return data)Send Cloudwatch logs matching a pattern to SQS queue
Keeping a retro style to sci-fi spaceships?
Is this wall load bearing? Blueprints and photos attached
different output for groups and groups USERNAME after adding a username to a group
Word to describe a time interval
Is 'stolen' appropriate word?
What do I do when my TA workload is more than expected?
Am I ethically obligated to go into work on an off day if the reason is sudden?
Can the DM override racial traits?
Sort list of array linked objects by keys and values
How do spell lists change if the party levels up without taking a long rest?
Is there a writing software that you can sort scenes like slides in PowerPoint?
Match Roman Numerals
Working through the single responsibility principle (SRP) in Python when calls are expensive
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?
Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?
US Healthcare consultation for visitors
How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?
Are there continuous functions who are the same in an interval but differ in at least one other point?
Can we generate random numbers using irrational numbers like π and e?
1960s short story making fun of James Bond-style spy fiction
How to type a long/em dash `—`
60's-70's movie: home appliances revolting against the owners
What is the padding with red substance inside of steak packaging?
AWS Lambda gets executed 3 times
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow to pass a querystring or route parameter to AWS Lambda from Amazon API GatewayCan an AWS Lambda function call anotherCan't add s3 notification for lambda using boto3AWS lambda function ConnectionError when configured with VPCAWS IoT and Lambda RuleAWS Lambda recursive invocation works too good?S3 copy inside lambda function timing outAWS Lambda Timeouts randomlyAWS node.js lambda request dynamodb but no response (no err, no return data)Send Cloudwatch logs matching a pattern to SQS queue
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have created a Lambda that subscribes to a specific log group and gets triggered everytime the log group is updated.
However, for some reason the Lambda gets triggered three times instead of just one. The Lambda is supposed to export log files to a S3 Bucket, and since it's triggered three times it exports the same logs three times. My first thought was that the Lambda was timing out and therefor was triggered multiple times but I've checked the logs and the execution is successful every time, and every execution has a unique RequestId.
Any thoughts about this? Any help is appreciated.
This is what my Lambda looks like:
import boto3
from datetime import timedelta, datetime
def lambda_handler(event, context):
startTime = datetime.utcnow() - timedelta(hours = 2)
endTime = datetime.utcnow()
cloudwatch = boto3.client('logs')
response = cloudwatch.create_export_task(
taskName = 'LogExport',
logGroupName = '/aws/lambda/logGroupName',
fromTime = int(round(startTime.timestamp() * 1000)),
to = int(round(endTime.timestamp() * 1000)),
destination='s3Bucket')
return
'status': 200,
'body': 'Lambda executed succesfully!'
amazon-web-services amazon-s3 aws-lambda export boto3
add a comment |
I have created a Lambda that subscribes to a specific log group and gets triggered everytime the log group is updated.
However, for some reason the Lambda gets triggered three times instead of just one. The Lambda is supposed to export log files to a S3 Bucket, and since it's triggered three times it exports the same logs three times. My first thought was that the Lambda was timing out and therefor was triggered multiple times but I've checked the logs and the execution is successful every time, and every execution has a unique RequestId.
Any thoughts about this? Any help is appreciated.
This is what my Lambda looks like:
import boto3
from datetime import timedelta, datetime
def lambda_handler(event, context):
startTime = datetime.utcnow() - timedelta(hours = 2)
endTime = datetime.utcnow()
cloudwatch = boto3.client('logs')
response = cloudwatch.create_export_task(
taskName = 'LogExport',
logGroupName = '/aws/lambda/logGroupName',
fromTime = int(round(startTime.timestamp() * 1000)),
to = int(round(endTime.timestamp() * 1000)),
destination='s3Bucket')
return
'status': 200,
'body': 'Lambda executed succesfully!'
amazon-web-services amazon-s3 aws-lambda export boto3
It would be helpful if you also shared your deployment configurations
– Kalev
Mar 8 at 13:28
Does this happen for every Lambda invocation, or just some? Does it always invoke exactly 3 times? Obviously this is a distributed system and has at-least-once semantics but I'd be surprised if it's duplicating invocations a lot.
– jarmod
Mar 8 at 15:29
What I experienced it always invokes three times when the lambda is triggered by an update in the log stream. When I run it manually it only invoke one time.
– Andpej
Mar 8 at 16:46
Can you share your Lambda's triggers from the console?
– Deiv
Mar 8 at 20:21
add a comment |
I have created a Lambda that subscribes to a specific log group and gets triggered everytime the log group is updated.
However, for some reason the Lambda gets triggered three times instead of just one. The Lambda is supposed to export log files to a S3 Bucket, and since it's triggered three times it exports the same logs three times. My first thought was that the Lambda was timing out and therefor was triggered multiple times but I've checked the logs and the execution is successful every time, and every execution has a unique RequestId.
Any thoughts about this? Any help is appreciated.
This is what my Lambda looks like:
import boto3
from datetime import timedelta, datetime
def lambda_handler(event, context):
startTime = datetime.utcnow() - timedelta(hours = 2)
endTime = datetime.utcnow()
cloudwatch = boto3.client('logs')
response = cloudwatch.create_export_task(
taskName = 'LogExport',
logGroupName = '/aws/lambda/logGroupName',
fromTime = int(round(startTime.timestamp() * 1000)),
to = int(round(endTime.timestamp() * 1000)),
destination='s3Bucket')
return
'status': 200,
'body': 'Lambda executed succesfully!'
amazon-web-services amazon-s3 aws-lambda export boto3
I have created a Lambda that subscribes to a specific log group and gets triggered everytime the log group is updated.
However, for some reason the Lambda gets triggered three times instead of just one. The Lambda is supposed to export log files to a S3 Bucket, and since it's triggered three times it exports the same logs three times. My first thought was that the Lambda was timing out and therefor was triggered multiple times but I've checked the logs and the execution is successful every time, and every execution has a unique RequestId.
Any thoughts about this? Any help is appreciated.
This is what my Lambda looks like:
import boto3
from datetime import timedelta, datetime
def lambda_handler(event, context):
startTime = datetime.utcnow() - timedelta(hours = 2)
endTime = datetime.utcnow()
cloudwatch = boto3.client('logs')
response = cloudwatch.create_export_task(
taskName = 'LogExport',
logGroupName = '/aws/lambda/logGroupName',
fromTime = int(round(startTime.timestamp() * 1000)),
to = int(round(endTime.timestamp() * 1000)),
destination='s3Bucket')
return
'status': 200,
'body': 'Lambda executed succesfully!'
amazon-web-services amazon-s3 aws-lambda export boto3
amazon-web-services amazon-s3 aws-lambda export boto3
edited Mar 8 at 14:16
Kalev
425312
425312
asked Mar 8 at 12:22
AndpejAndpej
298
298
It would be helpful if you also shared your deployment configurations
– Kalev
Mar 8 at 13:28
Does this happen for every Lambda invocation, or just some? Does it always invoke exactly 3 times? Obviously this is a distributed system and has at-least-once semantics but I'd be surprised if it's duplicating invocations a lot.
– jarmod
Mar 8 at 15:29
What I experienced it always invokes three times when the lambda is triggered by an update in the log stream. When I run it manually it only invoke one time.
– Andpej
Mar 8 at 16:46
Can you share your Lambda's triggers from the console?
– Deiv
Mar 8 at 20:21
add a comment |
It would be helpful if you also shared your deployment configurations
– Kalev
Mar 8 at 13:28
Does this happen for every Lambda invocation, or just some? Does it always invoke exactly 3 times? Obviously this is a distributed system and has at-least-once semantics but I'd be surprised if it's duplicating invocations a lot.
– jarmod
Mar 8 at 15:29
What I experienced it always invokes three times when the lambda is triggered by an update in the log stream. When I run it manually it only invoke one time.
– Andpej
Mar 8 at 16:46
Can you share your Lambda's triggers from the console?
– Deiv
Mar 8 at 20:21
It would be helpful if you also shared your deployment configurations
– Kalev
Mar 8 at 13:28
It would be helpful if you also shared your deployment configurations
– Kalev
Mar 8 at 13:28
Does this happen for every Lambda invocation, or just some? Does it always invoke exactly 3 times? Obviously this is a distributed system and has at-least-once semantics but I'd be surprised if it's duplicating invocations a lot.
– jarmod
Mar 8 at 15:29
Does this happen for every Lambda invocation, or just some? Does it always invoke exactly 3 times? Obviously this is a distributed system and has at-least-once semantics but I'd be surprised if it's duplicating invocations a lot.
– jarmod
Mar 8 at 15:29
What I experienced it always invokes three times when the lambda is triggered by an update in the log stream. When I run it manually it only invoke one time.
– Andpej
Mar 8 at 16:46
What I experienced it always invokes three times when the lambda is triggered by an update in the log stream. When I run it manually it only invoke one time.
– Andpej
Mar 8 at 16:46
Can you share your Lambda's triggers from the console?
– Deiv
Mar 8 at 20:21
Can you share your Lambda's triggers from the console?
– Deiv
Mar 8 at 20:21
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063163%2faws-lambda-gets-executed-3-times%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063163%2faws-lambda-gets-executed-3-times%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It would be helpful if you also shared your deployment configurations
– Kalev
Mar 8 at 13:28
Does this happen for every Lambda invocation, or just some? Does it always invoke exactly 3 times? Obviously this is a distributed system and has at-least-once semantics but I'd be surprised if it's duplicating invocations a lot.
– jarmod
Mar 8 at 15:29
What I experienced it always invokes three times when the lambda is triggered by an update in the log stream. When I run it manually it only invoke one time.
– Andpej
Mar 8 at 16:46
Can you share your Lambda's triggers from the console?
– Deiv
Mar 8 at 20:21