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

Improve documentation for users not in ap-southeast-2 #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,32 @@ This project helps you periodically add partitions to your Athena/Glue database

[Read more about why we built this, and how it can be used, in this blog post](https://www.gorillastack.com/news/cloudtrail-athena-query/).

## Prerequisite - Enable CloudTrail
## Prerequisites

### Enable CloudTrail

CloudTrail is an audit log of every action to occur in your AWS Action. It should be on all the time.

You can now [enable CloudTrail at the AWS Organization level](https://docs.aws.amazon.com/organizations/latest/userguide/services-that-can-integrate-ct.html), which means that CloudTrail for each account will be centrally logged and automatically enabled for all new accounts.

Read about how to [create your organization CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-trail-organization.html) here.
Currently for the CloudFormation template used in this project, CloudTrail must be enabled at an Organization level with no encryption and using no additional prefix in the S3 bucket.

![Cloudtrail Configuration Example](images/cloudtrail-config.png)

Read the AWS documentation about how to [create your organization CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-trail-organization.html) here.

### S3 Bucket to host the Lambda deployment package

If you are not using the `ap-southeast-2` AWS region you will need to copy the Lambda deployment package ZIP file to an S3 bucket in your chosen region. For example:

```
aws s3 mb s3://myorganization-athena-cloudtrail-partitioner
aws s3 cp s3://gorillastack-autotag-releases/partitioner-0.1.0.zip s3://myorganization-athena-cloudtrail-partitioner
```

## Installation

Install the Athena CloudTrail Partitioner through CloudFormation, either through the AWSCLI:
Install the Athena CloudTrail Partitioner through CloudFormation, either through the AWS CLI:

```
aws cloudformation deploy \
Expand All @@ -29,10 +44,18 @@ aws cloudformation deploy \
--parameter-overrides \
"OrganizationId=${ORGANIZATION_ID}" \
"S3BucketName=${S3_BUCKET_NAME}" \
"CodeS3BucketName=${CODE_S3_BUCKET_NAME}" \
--capabilities CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
```

or click this button to deploy throught the AWS Console:
Where:
- `${AWS_DEFAULT_REGION}` is your chosen AWS Region
- `${ORGANIZATION_ID}` is your AWS Organization ID which [can be found here](https://console.aws.amazon.com/organizations/home?#/organization/settings)
- `${S3_BUCKET_NAME}` is the S3 bucket where your CloudTrail trail is stored
- `${CODE_S3_BUCKET_NAME}` is the S3 bucket where you have copied the Lambda Deployment bundle to (you can omit this if you are using `ap-southeast-2`)

Alternatively you can click this button to deploy through the AWS Console if you are using `ap-southeast-2`:

[![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/quickcreate?stackName=athena-cloudtrail-partitioner&templateUrl=https%3A%2F%2Fgorillastack-cloudformation-templates.s3.amazonaws.com%2Fathena-cloudtrail-partitioner.yml)

6 changes: 3 additions & 3 deletions cf/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Description: Create the Glue Database and Crawler to make a queryable CloudTrail
Parameters:
OrganizationId:
Type: String
Description: The Organization Id of your organization (omit if you are not using an Org CloudTrail)
Description: The Organization Id of your organization
S3BucketName:
Type: String
Description: The name of the bucket containing your CloudTrail logs
CodeS3BucketName:
Type: String
Description: The name of the bucket containing the Lambda code
Description: The name of the bucket containing the Lambda code (this will need to be changed if not in ap-southeast-2)
Default: gorillastack-autotag-releases
CodeS3Key:
Type: String
Expand Down Expand Up @@ -253,4 +253,4 @@ Resources:
Arn:
Fn::GetAtt:
- PartitionLambda
- Arn
- Arn
Binary file added images/cloudtrail-config.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.