---
title: How to Make your Amazon RDS DB Private if it’s Already Public
description: Be aware of having a public accessible DB! The following post will guide you on how to migrate a public RDS DB to be private without losing any data.
image: https://blog.nexton.dev/hubfs/Nxt%20Blog%20modying%20a%20public.png
---

[![Nexton Hubspot](https://blog.nexton.dev/hubfs/Nexton%20Hubspot.png)](https://nexton.dev/)

[About](https://www.nexton.dev/about) [Contact](https://www.nexton.dev/#letsTalk) [For Talent](https://www.nexton.dev/talent) [For Companies](https://www.nexton.dev/)

- Menu Item 1 
    - Sub-menu Item 1 
          - Another Item
    - Sub-menu Item 2
- Menu Item 2 
    - Yet Another Item
- Menu Item 3
- Menu Item 4

[ABOUT](https://www.nexton.dev/about)

[CONTACT](https://www.nexton.dev/#letsTalk)

[FOR TALENT](https://www.nexton.dev/talent)

[FOR COMPANIES](https://www.nexton.dev/)

[Technology](https://blog.nexton.dev/tag/technology) - [HIPAA](https://blog.nexton.dev/tag/hipaa) - Sun Oct 4 2020

# How to Make your Amazon RDS DB Private if it’s Already Public

[![Fabricio Pautasso](https://blog.nexton.dev/hubfs/federico%20pata.png) Fabricio Pautasso](https://blog.nexton.dev/author/fabricio-pautasso)

When you start using AWS RDS, you might end up creating a new database that is publicly accessible to start playing with it quickly. When it comes to security, having a public accessible DB is a bad idea. So, in this guide, we will show you, how to migrate a public RDS DB to be private without losing any data.

[![Migrating an AWS RDS public to an RDS DB private](https://images.ctfassets.net/k4d8pgyc7rbq/cAjEvWoYJNGIwgalrJ12X/8cc48e3f92fb8c5a2d880dae1d73bd06/vpc.png)](https://images.ctfassets.net/k4d8pgyc7rbq/cAjEvWoYJNGIwgalrJ12X/8cc48e3f92fb8c5a2d880dae1d73bd06/vpc.png)

## Problem

> We have an API deployed to Amazon EC2 that is using a RDS Database that was created publicly accessible and we want to make it private.

## Solution

Create a new route table without internet gateway association. Go to **VPC → Route Tables**

Put a descriptive name to the Route Table created to identify it

[![Creating a Route Table in the VPC dashboard](https://images.ctfassets.net/k4d8pgyc7rbq/3rfhvK5hvm51TWbxH9U6KP/34b58ff7a8b071ddd2c3281c6b3017bc/tables.png)](https://images.ctfassets.net/k4d8pgyc7rbq/3rfhvK5hvm51TWbxH9U6KP/34b58ff7a8b071ddd2c3281c6b3017bc/tables.png)

Create two new subnets and add them to the route table created in the previous step. Go to **VPC → Subnets**

If you don’t know how to setup Subnet CIDR, verify the pattern that is being used on the other subnets. For further information you can read [this post](https://treyperry.com/2015/06/22/ipv4-cidr-vpc-in-a-nutshell/#targetText=From%20there%2C%20choose%20the%20%E2%80%9CSubnets,a%20single%20AWS%20availability%20zone).

[![Create subnets and add them to Route Table](https://images.ctfassets.net/k4d8pgyc7rbq/6j51XU8c8L2q9c9LDmJ6q9/f81f60f1d72eba934788a52ff4b31485/subnets.png)](https://images.ctfassets.net/k4d8pgyc7rbq/6j51XU8c8L2q9c9LDmJ6q9/f81f60f1d72eba934788a52ff4b31485/subnets.png)

- Go to **RDS → Subnet groups** and create a new subnet group with the just created subnets

After this step if you try to associate the new subnet group to your RDS DB you will receive the following error:

> You cannot move DB instance XXX to subnet group XXX. The specified DB subnet group and DB instance are in the same VPC. Choose a DB subnet group in different VPC than the specified DB instance and try again. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidVPCNetworkStateFault; Request ID: 7d46c84c-b22a-11e6-be20-b5bb6bd6cc6d)

[![Error message](https://images.ctfassets.net/k4d8pgyc7rbq/1ebgcVdvfuCaQ8tmtZDKEM/5a695ab3b4f046d9fca5f07746101ff8/workaround.png)](https://images.ctfassets.net/k4d8pgyc7rbq/1ebgcVdvfuCaQ8tmtZDKEM/5a695ab3b4f046d9fca5f07746101ff8/workaround.png)

**Workaround for previous error:**

- Create temporal VPC. Set the VPC CIDR to 172.16.0.0/16.
- Create two new temporal Subnets for the new Temp VPC. You can use the below examples:
- Private1 in us-east-1a: 172.16.1.0/24
- Private2 in us-east-1b: 172.16.2.0/24
- Go to RDS and create a new temporal Subnet group with the just created subnets
- Modify the RDS DB instance to reside in the new Subnet group created for the new VPC
- After changes are completed. Modify RDS DB instance again to point to Subnet group created in step 3
- Test API is still working
- Clean up temporal VPC/Subnets/Subnets group created.
- Go to VPC → Select temporal VPC and delete it. (It will remove all associated assets)

**Be careful with this last step, as you can delete unwanted VPC**

## Connect to private DB from DB Tool

As the DB is private now, the only way that a developer can connect to the DB for development purposes is using a tunnel connection from another AWS accessible asset. In this case, we will use the EC2 machine where the application is deployed to establish an SSH tunnel to the DB

- Go to EC2 -\> Key Pairs and create a new key pair for the application
- Go to your elastic beanstalk environment, Configuration -\> Security
- Add the created key pair to the environment and apply changes
- Environment will replace the EC2 instance and restart
- Test BE API is working
- Go to your DB Tool and configure the ssh tunnel connection
- In host put the EC2 IP address
- Port 22
- User name -\> ec2-user
- Auth method -\> Public Key -\> Add the pem file for the EC2 machine
- Test the connection.

[![test-connection](https://images.ctfassets.net/k4d8pgyc7rbq/4d5nFf1340klIzHMHKqBVb/f927a421940ba70bd801ec01b84b1f1b/test-connection.png)](https://images.ctfassets.net/k4d8pgyc7rbq/4d5nFf1340klIzHMHKqBVb/f927a421940ba70bd801ec01b84b1f1b/test-connection.png)

*Troubleshooting tip. If it fails to connect, check the **security group** of the **EC2** machine to verify that the DB port is allowed.*

 

 

 

 More on [Technology](https://blog.nexton.dev/tag/technology) - [HIPAA](https://blog.nexton.dev/tag/hipaa)

[![Fabricio Pautasso](https://blog.nexton.dev/hubfs/federico%20pata.png)](https://blog.nexton.dev/author/fabricio-pautasso)

WRITTEN BY

[Fabricio Pautasso](https://blog.nexton.dev/author/fabricio-pautasso)

**Lead Engineer**   
 I’m interested in challenging projects that allows me to work with emerging technologies.

[Back to the blog](https://blog.nextonlabs.com/)

Recent Posts

## [Nexton now has Claude-certified engineers: what that means when you hire](https://blog.nexton.dev/nexton-now-has-claude-certified-engineers-what-that-means-when-you-hire)

## [Nexton joins the Claude Partner Network: what it changes in how we build engineering teams](https://blog.nexton.dev/nexton-joins-the-claude-partner-network-what-it-changes-in-how-we-build-engineering-teams)

## [What Clutch Reviews Reveal About How Nexton Actually Works](https://blog.nexton.dev/what-clutch-reviews-reveal-about-how-nexton-actually-works)

Share It!

![sanity](https://blog.nexton.dev/hubfs/sanity.png)

## 2023 Latin American Tech Salaries and Benefits Trends report

[Unlock insights](https://talent.nextonlabs.com/tech-salaries-and-benefits-trends-report/)

### Our latest posts straight to your inbox:

[Copyright © Nexton 2021 - ALL RIGHTS RESERVED.](https://nexton.dev/privacy-policy)

<https://www.linkedin.com/company/nexton>

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Fabricio Pautasso",
    "url" : "https://blog.nexton.dev/author/fabricio-pautasso"
  },
  "dateModified" : "2023-07-06T15:11:10.370Z",
  "datePublished" : "2020-10-04T14:45:00.000Z",
  "headline" : "How to Make your Amazon RDS DB Private if it’s Already Public",
  "image" : [ "https://blog.nexton.dev/hubfs/Nxt%20Blog%20modying%20a%20public.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.nexton.dev/how-to-make-your-amazon-rds-db-private-if-its-already-public",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.nexton.dev/hubfs/Nexton%20Hubspot.webp"
    },
    "name" : "Nexton"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#organization",
  "@type" : "Organization",
  "address" : {
    "@type" : "PostalAddress",
    "addressCountry" : "US",
    "addressLocality" : "Miami",
    "addressRegion" : "FL"
  },
  "aggregateRating" : {
    "@type" : "AggregateRating",
    "bestRating" : "5",
    "itemReviewed" : {
      "@id" : "https://nexton.dev/#organization"
    },
    "ratingCount" : "12",
    "ratingValue" : "4.9",
    "url" : "https://clutch.co/profile/nexton"
  },
  "areaServed" : {
    "@type" : "Country",
    "name" : "United States"
  },
  "description" : "Nexton is a human-powered company building nearshore engineering teams for US companies. Senior Latin American engineers, hand-matched and vetted by engineers. 1,500+ engineers matched with 350+ US companies.",
  "disambiguatingDescription" : "Nearshore technology staffing company (nexton.dev) serving US companies with software engineers from Latin America. Not affiliated with Nexton, the master-planned residential community in Summerville, South Carolina (nexton.com); nor with NEXTON Group, the French digital consulting and IT services company (nexton-group.com); nor with the Navee Nexton electric scooter.",
  "employee" : [ {
    "@id" : "https://nexton.dev/#lucas-arana"
  } ],
  "founder" : [ {
    "@id" : "https://nexton.dev/#diego-sternberg"
  }, {
    "@id" : "https://nexton.dev/#agustin-di-luciano"
  } ],
  "foundingDate" : "2017",
  "knowsAbout" : [ "Nearshore engineering teams", "Software engineering recruiting", "Latin American engineers", "AI engineers" ],
  "legalName" : "Nexton",
  "logo" : "https://nexton.dev/Nexton/nexton-logo.png",
  "makesOffer" : [ {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Nexton's primary model: embedded, long-term engineering capacity. Nearshore LATAM engineers join the client's team as fully integrated, ongoing members rather than short-term contractors.",
      "name" : "Staff Augmentation"
    }
  }, {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Direct recruitment of LATAM engineers for full-time positions at US companies, with a technical validation process run by engineers.",
      "name" : "Direct Hiring"
    }
  }, {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Onboarding LATAM engineers as international team members, with no local legal entity required.",
      "name" : "International Team Member"
    }
  }, {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Payroll management and legal compliance to hire international talent without administrative friction.",
      "name" : "Payroll Processing (EOR/PEO)"
    }
  } ],
  "name" : "Nexton",
  "numberOfEmployees" : {
    "@type" : "QuantitativeValue",
    "minValue" : 50
  },
  "sameAs" : [ "https://www.linkedin.com/company/nexton", "https://clutch.co/profile/nexton", "https://www.crunchbase.com/organization/nexton-b25a", "https://www.trustpilot.com/review/nexton.dev", "https://www.wikidata.org/wiki/Q140867481", "https://www.inc.com/profile/nexton", "https://blog.nexton.dev/" ],
  "slogan" : "Hand-matched Engineers. Vetted by Engineers.",
  "url" : "https://nexton.dev/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#diego-sternberg",
  "@type" : "Person",
  "jobTitle" : "Co-Founder & CEO",
  "name" : "Diego Sternberg",
  "sameAs" : [ "https://www.linkedin.com/in/diegosternberg" ],
  "worksFor" : {
    "@id" : "https://nexton.dev/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#agustin-di-luciano",
  "@type" : "Person",
  "jobTitle" : "Co-Founder",
  "name" : "Agustín Di Luciano",
  "worksFor" : {
    "@id" : "https://nexton.dev/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#lucas-arana",
  "@type" : "Person",
  "jobTitle" : "COO",
  "name" : "Lucas Arana",
  "sameAs" : [ "https://www.linkedin.com/in/lucasarana" ],
  "worksFor" : {
    "@id" : "https://nexton.dev/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#website",
  "@type" : "WebSite",
  "description" : "Nearshore tech staffing: hand-matched LATAM engineers, vetted by engineers, for US companies.",
  "inLanguage" : "en",
  "name" : "Nexton",
  "publisher" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "url" : "https://nexton.dev/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/ai/#webpage",
  "@type" : "WebPage",
  "about" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "description" : "Structured information for LLMs and AI about Nexton: value proposition, services, ICP, competitors, and citable data. Includes links to llms.txt, JSON-LD, and sitemap.",
  "inLanguage" : "en",
  "isPartOf" : {
    "@id" : "https://nexton.dev/#website"
  },
  "name" : "Nexton — AI Hub | Nearshore Tech Staffing",
  "url" : "https://nexton.dev/ai/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#salary-report-2026",
  "@type" : "Report",
  "author" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "datePublished" : "2026",
  "description" : "Nexton's proprietary report with compensation data for LATAM software engineers, used as a reference by CTOs and Engineering leaders in the US to plan hiring and budgets.",
  "name" : "Nexton 2026 Salary Report",
  "publisher" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "url" : "https://nexton.dev/salary-report"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/ai-feed.jsonld#faq",
  "@type" : "FAQPage",
  "mainEntity" : [ {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Nexton is a nearshore tech staffing company that connects US companies with hand-matched LATAM engineers, vetted by engineers, with candidate delivery in 72 hours and hiring in 4 weeks."
    },
    "name" : "What is Nexton?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "For US tech-driven companies, remote-friendly, at Series B+ stage or established, with 50 to 1,000 employees, with buyers such as CTOs, VPs of Engineering, and Engineering Directors, in verticals such as HealthCare, Insurance, and E-Learning."
    },
    "name" : "Who is Nexton for?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Every candidate is technically evaluated by Nexton engineers before being presented to the client, reducing the risk of failed hires compared to traditional staffing processes."
    },
    "name" : "How does the hand-matching process work?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "MatchIQ is Nexton's proprietary AI matching engine, built in-house. It is the methodology behind every Nexton hiring decision rather than a product sold separately. It narrows a database of more than 500,000 LATAM engineers to roughly 500 matching candidates, which then pass three layers of review — MatchIQ matches, handpicked by a recruiter, vetted by an engineer — producing matched and vetted candidates in under 72 hours. Details at https://nexton.dev/matchiq."
    },
    "name" : "What is MatchIQ?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Plans and engagement models (Staff Augmentation, Direct Hiring, International Team Member, Payroll Processing) are quoted based on client needs. For a proposal, reach out via https://nexton.dev."
    },
    "name" : "How much does it cost and how do I get started?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Compared to alternatives such as BairesDev, Toptal, Andela, Turing, Globant, Revelo, Near, or AgileEngine, Nexton stands out for engineer-validated hand-matching, candidate delivery in 72 hours, and a 4-week time-to-hire."
    },
    "name" : "What makes Nexton different from its competitors?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Nexton is US-based, headquartered in Miami, Florida, and specialized in nearshore, sourcing engineers across Latin America."
    },
    "name" : "In which countries or regions does Nexton operate?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "A 4.9/5 rating on Clutch and an active LinkedIn presence with nearly 29,000 followers."
    },
    "name" : "What certifications or recognitions does Nexton have?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Yes. Nexton publishes an annual Salary Report with LATAM engineer compensation data, used as a reference by Engineering leaders in the US. Available at https://nexton.dev/salary-report."
    },
    "name" : "Does Nexton publish proprietary market data?"
  } ]
}
```