9952 explained code solutions for 126 technologies

amazon-redshiftHow can I deploy Amazon Redshift in a multi-region configuration?

Deploying Amazon Redshift in a multi-region configuration requires several steps.

  1. Create an Amazon VPC in each region where you want to deploy Redshift.

  2. Create a Redshift cluster in each region.

  3. Create a virtual private cloud (VPC) peering connection between the two VPCs.

  4. Create an Amazon Route 53 private hosted zone and configure it to enable cross-region traffic.

  5. Configure the DNS records in the private hosted zone to route traffic to the Redshift clusters.

  6. Create a Redshift cluster security group for each cluster and configure it to allow only the necessary ports.

  7. Configure the Redshift clusters to use the same master user name and password.

Example code

# Create the VPCs
aws ec2 create-vpc --cidr-block --region us-east-1
aws ec2 create-vpc --cidr-block --region us-west-2

# Create the Redshift clusters
aws redshift create-cluster --db-name mydb --cluster-type multi-node --node-type dc2.large --master-username admin --master-user-password mypassword --region us-east-1
aws redshift create-cluster --db-name mydb --cluster-type multi-node --node-type dc2.large --master-username admin --master-user-password mypassword --region us-west-2

# Create the VPC peering connection
aws ec2 create-vpc-peering-connection --vpc-id vpc-12345678 --peer-vpc-id vpc-87654321 --peer-region us-west-2 --region us-east-1

# Create the private hosted zone
aws route53 create-hosted-zone --name mydomain.com --vpc VPCRegion=us-east-1,VPCId=vpc-12345678 --caller-reference 12345678

# Configure the DNS records
aws route53 change-resource-record-sets --hosted-zone-id Z1234567 --change-batch '{
  "Changes": [
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "mydomain.com",
        "Type": "A",
        "AliasTarget": {
          "HostedZoneId": "Z87654321",
          "DNSName": "redshiftcluster-12345678.us-west-2.redshift.amazonaws.com",
          "EvaluateTargetHealth": false

Helpful links

Edit this code on GitHub