Giter Club home page Giter Club logo

aws-dms-example's Introduction

DMS Example

Creates an example AWS DMS for replicating an (on-prem) Oracle database to a cloud-based Postgres database.

terraform-main

This will create:

  • VPC with a VPN gateway
  • Source and target RDS instances
  • DMS Endpoints for each RDS instance
  • DMS Replication instance

This is designed to be deployed once.

terraform-repltask

This will create:

  • DMS Replication Task

This is designed to be deployed multiple times.

Set Variables

Set the following variables in variables.tf:

Terraform Remote State

  • bucket - an s3 bucket that exists in your aws space (see Preperation)
  • lock_table - a dynamodb table in your aws space with the primary key LockID (see Preperation)

Replication main

Set the following environment variables (substituting the details of your application)

  • export TF_VAR_source_snapshot=<snapshot to restore source database from>
  • export TF_VAR_source_db_name=<source database name>
  • export TF_VAR_source_password=<source admin user password>
  • export TF_VAR_source_username=<source admin user password>
  • export TF_VAR_source_app_username=<source application user password>
  • export TF_VAR_source_app_password=<source application user password>
  • export TF_VAR_target_db_name=<target database name>
  • export TF_VAR_target_password=<admin user password>
  • export TF_VAR_target_username=<admin user account name>

Replication task

Edit _variables.tf. Update key = "dblink-repl" within the s3 backend definition to another value, for example key = "dblink-appname".

Set the following environment variables (substituting the details of your application)

  • export TF_VAR_stack_name=<a unique name for this stack - e.g. dblink-appname>
  • export TF_VAR_dms_source_arn=<source endpoint ARN>
  • export TF_VAR_dms_target_arn=<target endpoint ARN>
  • export TF_VAR_replication_instance_arn=<replication instance ARN>
  • export TF_VAR_replication_task_id=<a unique name for this replication task>

Creating your infrastructure

  1. terraform init
  2. terraform plan
  3. terraform apply

This command will output your database endpoint, which you will need below.

Destroying your infrastructure

  1. If you have run the infrastructure overnight you will have backups in your backup bucket. You will need to remove these so the terraform can destroy the bucket.
  2. terraform destroy

This is assuming that you ran terraform init previously on the same machine This command will tear down everything that terraform created.

VPC Peering

Follow the VPC Peering guide:

  1. Ensure your requester and accepter VPCs do not have overlapping IP address spaces.
  2. The owner of the requester VPC sends a request to the owner of the accepter VPC to create the VPC peering connection.
  3. The owner of the accepter VPC accepts the VPC peering connection request to activate the VPC peering connection.
  4. Add a route to each VPC's route tables that points to the IP address range of the other VPC.
  5. Update security groups to allow traffic from either VPC.
  6. Modify your VPC connection to enable DNS hostname resolution.

aws-dms-example's People

Contributors

aynsof avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.