This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import aws-cdk packages | |
import * as cdk from '@aws-cdk/core'; | |
import * as s3 from '@aws-cdk/aws-s3'; | |
import * as lambda from '@aws-cdk/aws-lambda'; | |
import * as lambdaEventSources from '@aws-cdk/aws-lambda-event-sources'; | |
export class HowToTriggerLambdaFromS3Stack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws dynamodb put-item \ | |
--table-name Table \ | |
--item '{ | |
"id": {"S": "test123"} | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import aws-cdk packages | |
import * as cdk from '@aws-cdk/core'; | |
import * as dynamodb from '@aws-cdk/aws-dynamodb'; | |
import * as lambda from '@aws-cdk/aws-lambda'; | |
import { DynamoEventSource } from '@aws-cdk/aws-lambda-event-sources'; | |
export class HowToTriggerLambdaFromDdbStreamStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws sqs get-queue-url --queue-name OurSQSQueue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Loop over each event record and log to the console. | |
* Since this is a Lambda Function, the log statements will | |
* also be logged to CloudWatch. | |
*/ | |
exports.handler = async (event) => { | |
event.Records.forEach((record) => { | |
console.log('Record: %j', record); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import aws-cdk packages | |
import * as cdk from '@aws-cdk/core'; | |
import * as sqs from '@aws-cdk/aws-sqs'; | |
import * as lambda from '@aws-cdk/aws-lambda'; | |
import * as lambdaEventSources from '@aws-cdk/aws-lambda-event-sources'; | |
export class HowToTriggerLambdaFromSqsStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |