Closed VTracyHuang closed 1 month ago
I'm going to transfer this to the AWS repo and someone will take a look.
Hey @VTracyHuang, thanks for reaching out! The Athena CloudWatch Connector is a SAM Application from the AWS Serverless Application Repository. It's documentation is located here: https://docs.aws.amazon.com/athena/latest/ug/connectors-cloudwatch.html.
Pulumi supports deploying applications from the AWS Serverless Application Repository using the serverlessrepository.CloudFormationStack
resource.
A sample application using the Athena CloudWatch connector would look like this:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const athenaConnectorApp = aws.serverlessrepository.getApplication({
applicationId: "arn:aws:serverlessrepo:us-east-1:292517598671:applications/AthenaCloudwatchConnector",
});
const spillBucket = new aws.s3.BucketV2("spill-bucket", {
bucketPrefix: "spill-bucket",
forceDestroy: true,
});
const functionName = "athena-cloudwatch-connector"
const athenaConnector = new aws.serverlessrepository.CloudFormationStack("athena-connector", {
applicationId: athenaConnectorApp.then(app => app.applicationId),
semanticVersion: athenaConnectorApp.then(app => app.semanticVersion),
capabilities: athenaConnectorApp.then(app => app.requiredCapabilities),
parameters: {
AthenaCatalogName: functionName,
SpillBucket: spillBucket.bucket,
},
});
const region = aws.getRegionOutput();
const identity = aws.getCallerIdentityOutput();
const partition = aws.getPartitionOutput();
const catalog = new aws.athena.DataCatalog("cloudwatch-catalog", {
name: "cloudwatch-catalog",
description: "Example CloudWatch data catalog",
type: "LAMBDA",
parameters: {
"function": pulumi.interpolate`arn:${partition.id}:lambda:${region.name}:${identity.accountId}:function:${functionName}`,
},
}, { dependsOn: athenaConnector });
For more in depth configuration options please refer to the AWS docs.
I'll add this to our examples here: https://github.com/pulumi/pulumi-aws/tree/master/examples
Hi, I wanna create a new Athena data source to query the Amazon CloudWatch Logs related tables. But I found the docs about Athena and lambda are both very simple description. Can you give me more guidance to create the Athena CloudWatch Connector?