Skip to content

This AWS CDK construct modifies the storage format of CloudFront logs in S3 to make them easier to query with Athena and Glue. By enabling event notifications to EventBridge for logs generated by CloudFront, it detects their creation and uses a Step Functions state machine to copy them to a specified S3 bucket (with a specified prefix) while ...

License

Notifications You must be signed in to change notification settings

gammarers/aws-cloudfront-access-log-relocater

Repository files navigation

AWS CloudFront Access Log Relocater

GitHub npm (scoped) GitHub Workflow Status (branch) GitHub release (latest SemVer)

View on Construct Hub

This AWS CDK construct modifies the storage format of CloudFront logs in S3 to make them easier to query with Athena and Glue. By enabling event notifications to EventBridge for logs generated by CloudFront, it detects their creation and uses a Step Functions state machine to copy them to a specified S3 bucket (with a specified prefix) while also providing functionality to delete the original files.

Install

TypeScript

install by npm

npm install @gammarers/aws-cloudfront-access-log-relocater

install by yarn

yarn add @gammarers/aws-cloudfront-access-log-relocater

Example

import { CloudFrontAccessLogRelocater } from '@gammarers/aws-cloudfront-access-log-relocater';

declare const logBucket: s3.Bucket;

new CloudFrontAccessLogRelocater(stack, 'CloudFrontAccessLogRelocater', {
  accessLogSource: {
    bucket: logBucket,
    objectPrefix: 'origin-logs',
  },
  accessLogDestination: {
    bucket: logBucket,
    objectPrefix: 'partitioning-log',
  },
});

License

This project is licensed under the Apache-2.0 License.

About

This AWS CDK construct modifies the storage format of CloudFront logs in S3 to make them easier to query with Athena and Glue. By enabling event notifications to EventBridge for logs generated by CloudFront, it detects their creation and uses a Step Functions state machine to copy them to a specified S3 bucket (with a specified prefix) while ...

Resources

License

Stars

Watchers

Forks

Packages

No packages published