CDK Construct for creating Athena resources
Project description
CDK Athena WorkGroup
AWS CDK L3 construct for managing Athena WorkGroups and named queries.
Because I couldn't get @aws-cdk/aws-athena.CfnWorkGroup to work and @aws-cdk/custom-resources.AwsCustomResource has no support for tags.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
workgroup = WorkGroup(self, "WorkGroup",
name="TheName", # required
desc="Some description",
publish_cloud_watch_metrics_enabled=True,
enforce_work_group_configuration=True,
requester_pays_enabled=True,
bytes_scanned_cutoff_per_query=11000000,
result_configuration={
"output_location": "s3://some-bucket/prefix",
"encryption_configuration": {
"encryption_option": EncryptionOption.SSE_S3
}
}
)
query = NamedQuery(self, "a-query",
name="A Test Query",
database="audit",
desc="This is the description",
query_string="""
SELECT
count(*) AS assumed,
split(useridentity.principalid, ':')[2] AS user,
resources[1].arn AS role
FROM cloudtrail_logs
WHERE
eventname='AssumeRole' AND
useridentity.principalid is NOT NULL AND
useridentity.principalid LIKE '%@%'
GROUP BY
split(useridentity.principalid,':')[2],
resources[1].arn
""",
work_group=workgroup
)
cdk.Tag.add(workgroup, "HelloTag", "ok")
cdk.CfnOutput(self, "WorkGroupArn",
value=workgroup.arn
)
cdk.CfnOutput(self, "WorkGroupName",
value=workgroup.name
)
cdk.CfnOutput(self, "QueryId",
value=query.id
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cdk-athena-2.1.0.tar.gz
(114.6 kB
view hashes)
Built Distribution
cdk_athena-2.1.0-py3-none-any.whl
(112.8 kB
view hashes)
Close
Hashes for cdk_athena-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75f6fcfb5786d0362269d58b5879a77fe5824586a62c33067b4cb0858f5e3427 |
|
MD5 | 1460327db5edf21b8538b874f9ec2752 |
|
BLAKE2b-256 | fc20d6f795baab1028f0a51d0b194f209edfe45205e0bf85d4c909fce02ca7de |