|
| 1 | +# Amazon DynamoDB to S3 with zero-ETL using AWS Glue with Terraform |
| 2 | + |
| 3 | +This pattern demonstrates how to create a zero-ETL integration between Amazon DynamoDB and Amazon S3 using AWS Glue transformation job. The AWS Glue job copies data in the specified format, which can be queried using Amazon Athena. |
| 4 | + |
| 5 | +Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/dynamodb-glue-s3-terraform |
| 6 | + |
| 7 | +Important: This application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example. |
| 8 | + |
| 9 | +## Requirements |
| 10 | + |
| 11 | +* [Create an AWS account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) if you do not already have one and log in. The IAM user that you use must have sufficient permissions to make necessary AWS service calls and manage AWS resources. |
| 12 | +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed and configured |
| 13 | +* [Git Installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) |
| 14 | +* [Terraform](https://www.terraform.io/) installed |
| 15 | + |
| 16 | +## Deployment Instructions |
| 17 | + |
| 18 | +1. Create a new directory, navigate to that directory in a terminal and clone the GitHub repository: |
| 19 | + ``` |
| 20 | + git clone https://github.com/aws-samples/serverless-patterns |
| 21 | + ``` |
| 22 | +2. Change directory to the pattern directory: |
| 23 | + ``` |
| 24 | + cd dynamodb-glue-s3-terraform |
| 25 | + ``` |
| 26 | +3. Run below terraform commands to deploy to your AWS account in the desired region (default is us-east-1): |
| 27 | + ``` |
| 28 | + terraform init |
| 29 | + terraform validate |
| 30 | + terraform plan -var aws_region=<YOUR_REGION> |
| 31 | + terraform apply -var aws_region=<YOUR_REGION> |
| 32 | + ``` |
| 33 | +
|
| 34 | +## How it works |
| 35 | +
|
| 36 | +This Terraform pattern creates zero-ETL integration that automatically exports DynamoDB data to S3 using AWS Glue. The AWS Glue job reads from the Amazon DynamoDB table and writes the data in the specified format (currently specified as Parquet in the script) to an encrypted Amazon S3 bucket for potential use in analytics and/or for long-term storage. The entire infrastructure is provisioned with the required IAM permissions, and includes automated testing script to validate the data pipeline functionality. |
| 37 | +
|
| 38 | + |
| 39 | +
|
| 40 | +## Testing |
| 41 | +
|
| 42 | +After deployment, run ./test.sh. This script adds rows to Amazon DynamoDB database and triggers the AWS Glue job. Once the job is complete, check Amazon S3 for the target files. |
| 43 | +
|
| 44 | +## Cleanup |
| 45 | + |
| 46 | +1. Delete the stack |
| 47 | + ``` |
| 48 | + terraform destroy -var aws_region=<YOUR_REGION> |
| 49 | + ``` |
| 50 | +---- |
| 51 | +Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 52 | +
|
| 53 | +SPDX-License-Identifier: MIT-0 |
0 commit comments