1. Make an SQS queue called "signal hint pipe" with a lambda called "signal hint handler" that responds to queue-events. Both should output logs in `pulumi logs`

    TypeScript

    In this program, we're creating an AWS SQS Queue and an AWS Lambda Function. The SQS Queue is named "signal_hint_pipe" and the lambda, which will handle events from the queue, is named "signal_hint_handler". A log subscription will be set up for both the queue and the lambda, so the logs for both of these resources are available using pulumi logs.

    import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as awsx from "@pulumi/awsx"; // Create an SQS queue const queue = new aws.sqs.Queue("signal_hint_pipe"); // Create a Lambda function const lambdaFunc = new aws.lambda.Function("signal_hint_handler", { runtime: "nodejs12.x", code: new pulumi.asset.AssetArchive({ ".": new pulumi.asset.FileArchive("./app"), }), handler: "index.handler", events: [{ sqs: { arn: queue.arn, }, }], }); // Create log group and log stream for the SQS queue const queueLogGroup = new aws.cloudwatch.LogGroup("queueLogGroup"); const queueLogStream = new aws.cloudwatch.LogStream("queueLogStream", { logGroupName: queueLogGroup.name }); // Create log group and log stream for the Lambda const lambdaLogGroup = new aws.cloudwatch.LogGroup("lambdaLogGroup"); const lambdaLogStream = new aws.cloudwatch.LogStream("lambdaLogStream", { logGroupName: lambdaLogGroup.name }); // Subscribe to the logs for the queue const queueSubscription = new awsx.cloudwatch.LogSubscription("queueSubscription", queueLogGroup, (log) => { console.log(JSON.stringify(log)); }); // Subscribe to the logs for the lambda const lambdaSubscription = new awsx.cloudwatch.LogSubscription("lambdaSubscription", lambdaLogGroup, (log) => { console.log(JSON.stringify(log)); });

    Please replace "./app" with the path to the directory containing your lambda function code. The code is expected to be in a file named index.js, and the handler function within that file should be named handler. If your setup is different, please replace "index.handler" with the appropriate handler function identifier.