Skip to content

Commit 0d9214b

Browse files
authored
Merge pull request #77 from aws-samples/add-source-code-for-eventbridge-and-lambda-blog-post
Adding source for blog post on Amazon EventBridge and AWS Lambda
2 parents 571699d + 4539c29 commit 0d9214b

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
<Nullable>enable</Nullable>
6+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
7+
<AWSProjectType>Lambda</AWSProjectType>
8+
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
9+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
10+
<!-- Generate ready to run images during publishing to improve cold start time. -->
11+
<PublishReadyToRun>true</PublishReadyToRun>
12+
</PropertyGroup>
13+
<ItemGroup>
14+
<PackageReference Include="Amazon.Lambda.CloudWatchEvents" Version="4.3.0" />
15+
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
16+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
17+
</ItemGroup>
18+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"source": ["aws.s3"],
3+
"detail-type": ["Object Created"],
4+
"detail": {
5+
"bucket": {
6+
"name": ["eventbridge-lambda-and-s3-example"]
7+
}
8+
}
9+
}
10+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Amazon.Lambda.Core;
2+
using Amazon.Lambda.CloudWatchEvents.S3Events;
3+
using System.Text.Json;
4+
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
5+
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
6+
7+
namespace EventBridgeLambdaAndS3Example;
8+
9+
public class Function
10+
{
11+
public void FunctionHandler(S3ObjectCreateEvent s3ObjectCreateEvent, ILambdaContext context)
12+
{
13+
context.Logger.LogLine("S3 Object Create Event Received");
14+
context.Logger.LogLine(JsonSerializer.Serialize(s3ObjectCreateEvent));
15+
}
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Event-driven .NET applications with AWS Lambda and Amazon EventBridge
2+
3+
This is a companion project to a forthcoming blog post on using Amazon EventBridge with an AWS Lambda function.
4+
5+
This readme will be updated to link to the blog post soon.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"Information": [
3+
"This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
4+
"To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
5+
"dotnet lambda help",
6+
"All the command line options for the Lambda command can be specified in this file."
7+
],
8+
"profile": "",
9+
"region": "",
10+
"configuration": "Release",
11+
"function-architecture": "x86_64",
12+
"function-runtime": "dotnet6",
13+
"function-memory-size": 256,
14+
"function-timeout": 30,
15+
"function-handler": "EventBridgeLambdaAndS3Example::EventBridgeLambdaAndS3Example.Function::FunctionHandler"
16+
}

0 commit comments

Comments
 (0)