Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Athena CloudWatch Connector #4393

Closed
VTracyHuang opened this issue Aug 22, 2024 · 3 comments
Closed

About Athena CloudWatch Connector #4393

VTracyHuang opened this issue Aug 22, 2024 · 3 comments
Assignees
Labels
kind/question Questions about existing features resolution/fixed This issue was fixed

Comments

@VTracyHuang
Copy link

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?

@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Aug 22, 2024
@justinvp justinvp added the kind/question Questions about existing features label Aug 22, 2024
@justinvp
Copy link
Member

I'm going to transfer this to the AWS repo and someone will take a look.

@justinvp justinvp transferred this issue from pulumi/pulumi Aug 22, 2024
@flostadler
Copy link
Contributor

flostadler commented Aug 23, 2024

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.

@flostadler flostadler removed the needs-triage Needs attention from the triage team label Aug 23, 2024
@flostadler
Copy link
Contributor

I'll add this to our examples here: https://github.com/pulumi/pulumi-aws/tree/master/examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Questions about existing features resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants