Prerequisites
- By default, Athena authentication uses role-based access. You will need the trust policy prepopulated with the data-syncing service’s identifier to grant access. It should look similar to the following JSON object with a proper service account identifier:
Step 1: Create a destination bucket, service policy, and role
Create Athena target bucket
Follow these steps to create a bucket to be used for staging data before transferring to a destination.- Navigate to the S3 service page.
- Click Create bucket.
- Enter a Bucket name, select an AWS Region, and modify any of the default settings as desired. Note: Object Ownership can be set to “ACLs disabled” and Block Public Access settings for this bucket can be set to “Block all public access” as recommended by AWS. Make note of the Bucket name and AWS Region.
- Click Create bucket.
Create Athena access policy
- Navigate to the IAM service page, click on the Policies navigation tab, and click Create policy.
- Click the JSON tab, and paste the following policy, being sure to replace
ACCOUNT_ID,WORKGROUP,BUCKET_NAMEandSCHEMAwith the your account information.WORKGROUPshould beprimaryunless otherwise specified during connection configuration.BUCKETshould refer to the bucket created in the previous step.SCHEMAused below does not need to be created ahead of time. If it does not exist, it will be created automatically before transferring data.
JSON policy
Athena vs. S3 permissionsBecause Athena uses S3 as the underlying storage layer, the Resource access requested in the policy is scoped down via resource-specific permissions in the S3 actions.
Schema vs. DatabaseDuring destination onboarding, you will be asked to provide both a “schema” and a “database”. Though those are mostly synonymous in Athena, they are used for two different purposes here:
schemashould be the name of the folder in S3 under which the final data will be written.databaseshould be the name of the folder in S3 in which the Athena query results are written (i.e., the automatically generatedathena_output/data).
- Click through to the Review step, choose a name for the policy, for example,
transfer-service-policy(this will be referenced in the next step), add a description, and click Create policy.
Create role
- Navigate to the IAM service page.
- Navigate to the Roles navigation tab, and click Create role.
- Select Custom trust policy and paste the provided trust policy (from the prerequisite) to allow AssumeRole access to this role. Click Next.
- Add the permissions policy created above, and click Next.
- Enter a Role name, for example,
transfer-role, and click Create role. - Once successfully created, search for the created role in the Roles list, click the role name, and make a note of the ARN value.
Step 2: Add your destination
- Securely share your database, schema, workgroup, bucket name, bucket region, and IAM Role ARN with us to complete the connection.