← Back to list

Aurora Database with EC2

Create an Amazon Aurora DB and connect it with Amazon EC2!

Johnny Louis · 2025-04-25 03:28 · 0 claps · 7.3 min read
#aws-rds #aws-ec2-instance #cloud #aws #pthon
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud

Aurora Database with EC2

Create an Amazon Aurora DB and connect it with Amazon EC2!

Most of the time we use databases to hold information we want to store, update, and use. In this project, we’re creating an Amazon Aurora database to store and display data for our very own web application!

Archtecture diagram for this project

Archtecture diagram for this project

STEP 1

Login to AWS

For this project you’ll need your IAM user, not your root user. If you are already logged in as your IAM user, skip straight to Step 2!

If you don’t have an IAM user yet — here are the steps to create one (this takes less than 10 mins).

  • Head to your AWS Account as the root user.
  • Open the AWS IAM console.
  • From the left-hand navigation panel, choose Users.
  • Choose Create user.
  • For the User name, use Yourname-IAM-Admin‍
  • Make sure to select the checkbox next to Provide user access to the AWS Management Console — optional.‍

Created IAM Admin user

Created IAM Admin user

  • For the console password, choose Custom password.
  • Type in a password that you will be able to remember/access in the future.
  • Deselect the checkbox for Users must create a new password at next sign-in — Recommended.

Set up user password

Set up user password

  • Choose Next.
  • In the permissions set up page, choose Attach policies directly.
  • From the list of Permissions policies, select AdministratorAccess.

Attach policies

Attach policies

  • Choose Next.
  • Choose Create user.
  • Voilà — you’ve just created your new user! Stay on this page.
  • Choose Download .csv file.

  • Copy the Console sign-in URL.
  • Now you’re ready to start using your IAM user. 🏁
  • Log out of your root user’s AWS Account.
  • Paste and go to your copied console sign-in URL.
  • Open your downloaded .csv file containing your user’s access instructions.
  • Log in using your IAM user’s username and password in the .csv file.

STEP 2

Create an Aurora MySQL Database

First things first… we need a relational database. Then we can connect it to our web app server and get cracking.

In this step, you’re going to:

  1. Create an Aurora relational database from scratch

First — check your Region

  • Take note of your Region in the top right of your AWS Console.
  • It doesn’t matter exactly which Region you have, as long as you’re aware of it.

Step 2: Remember the region you are in

Step 2: Remember the region you are in

Let’s create your Aurora database

  • Head to the RDS console — search for RDS in the search bar at the top of the screen.
  • Notice that even if you search for Aurora, the same result shows up!

Step 2: Search for RDS in the AWS console

Step 2: Search for RDS in the AWS console

  • In the left navigation bar, select Databases.
  • In the Database section, select Create Database.
  • On the Create database page, choose Standard Create.
  • In the Configuration section, make the following changes:
  • For Engine type, choose Aurora (MySQL Compatible).

Step 2: First part of configuration Aurora Database

Step 2: First part of configuration Aurora Database

  • In the Settings section, set these values:
  • DB cluster identifier: nextwork-db-cluster
  • Master username: admin
  • For Credentials management select Self managed.
  • Master password: Type a password (eg. n3xtw0rk)
  • Confirm password: Retype the password.
  • Make sure you save your database login details somewhere safe! You’ll need them later on.

Step 2: Set up Aurora login credentials

Step 2: Set up Aurora login credentials

  • Leave the Cluster storage configuration settings as default.
  • In the Instance configuration section, set these values:
  • Burstable classes (includes t classes)
  • db.t3.medium

Step 2: Aurora Instance configuration

Step 2: Aurora Instance configuration

  • In the Availability and durability section, use the default values. We’ll jump into what this means later!
  • In the Connectivity section, the first thing it asks us is whether we need to connect to an EC2 instance.

🛑 STOP!

Before we go any further, have a think for yourself. Do you think we need to connect our Aurora database to an EC2 instance? What is it we’re trying to achieve here??????????

That’s it! 😁 We’re trying to connect a web app server to our Aurora database. Yup! That’s our cue to set up an EC2 instance to be that web app server.

Bottom line; we definitely need an EC2 instance.

  • For Compute resource, choose Connect to an EC2 compute resource.
  • Now select the drop down for EC2 instance, and choose…. hold on a minute! We haven’t even created an EC2 instance. Let’s do that first, then come back to this.

Step 3

Launch an EC2 instance

n this step, we’re going to create an Amazon EC2 instance using our default VPC and default subnets.

In this step, you’re going to:

  • Create an EC2 instance to host a web app (we’ll create the web app itself in the next project)
  • It will look like this diagram:

Step 3: Architecture diagram for our app

Step 3: Architecture diagram for our app

  • Open a new tab in your web browser and go to your AWS console (this means we can keep our Aurora database set-up in progress!)
  • In the upper-right corner of the AWS Management Console, make sure your AWS Region is the same as that in your Aurora database creation.
  • In the AWS console search bar, search for EC2

Step 3: EC2 for the app

Step 3: EC2 for the app

  • Select Instances in the left hand menu and choose Launch instances
  • Choose the following settings in the Launch an instance page.
  • Under Name and tags, for Name, enter nextwork-ec2-instance-web-server
  • Under Application and OS Images (Amazon Machine Image), choose Amazon Linux.
  • Choose the Amazon Linux 2023 AMI.
  • Keep the defaults for the other choices.

  • Under Instance type, choose t2.micro.
  • Under Key pair (login), choose a Create new key pair
  • For your Key pair name, enter NextWorkAuroraApp
  • Leave your Key pair type as RSA
  • Leave your Private key file format as .pem since we’re using SSH later on to access our EC2 instance.

Select Create key pair

A new file will automatically download to your computer — don’t be alarmed! This is your new key pair. We’ll need it for later in the project to access our EC2 instance. Notice that it’s a .pem file — cool!

  • Back in our EC2 creation, under Network settings, set these values and keep the other values as their defaults:
  • For Allow SSH traffic from, choose your IP address if it’s correct (you can check your IP by clicking here). Otherwise select Anywhere.
  • Check the boxes for Allow HTTP traffic from the internet.
  • Leave the default values for the remaining sections.
  • Review the Summary panel of your instance configuration

  • When you’re ready, choose Launch instance.
  • Navigate back to your list of EC2 instances, and then select the checkbox next to your new instance.
  • In the Details tab, note the following important details:
  • In Instance summary, note the Public IPv4 DNS.
  • Note the value for Key pair name.
  • Wait until Instance state for your instance is Running before continuing.

STEP 4

Finish creating your Aurora Database

Nice work! Now that we’ve got our EC2 instance ready to go, we can go back to creating our Aurora database. This time, we’ll connect it to our new EC2 instance.

  • Navigate back to your open tab that you were creating our Aurora database in.
  • We were up to the Connectivity section. But this time we have one big advantage…we have an EC2 instance! Woohoo!
  • For Compute resource, choose Connect to an EC2 compute resource.
  • Now select the drop down for EC2 instance, and choose nextwork-ec2-instance-web-server.
  • NOTE: You may need to select the refresh button to the right of the EC2 instance drop-down.

Step 4: Connect Aurora Database to EC2 instance

Step 4: Connect Aurora Database to EC2 instance

  • Scroll down and open the Additional configuration section.
  • Enter sample for Initial database name.

Step 4: Add “sample” as database initial name

Step 4: Add “sample” as database initial name

  • Keep the default settings for the other options.
  • Select Create database.
  • Close any pop-ups that appear.
  • Your new DB cluster will show in the Databases list with the status Creating.

Step 4: Success! Aurora Database cluster created

Step 4: Success! Aurora Database cluster created

Do you notice that your database has the name nextwork-db-cluster and that’s there’s two of them? What’s with that?

  • Wait for the Status of your new DB cluster to show as Available.
  • Select the DB identifier of your top database to take a look at the details.
  • Notice that there are two Endpoints in our Database. Cool! This is our cluster in action.

Step 4: Showing two “Endpoints” for our database

Step 4: Showing two “Endpoints” for our database

  • Yay! We’ve created a new relational database and have an EC2 instance waiting for our beautiful new web app. Can’t wait to build that web app and connect it to our database in the next project!

🛑 STEPS BELOW:

Delete your database cluster: Open the Amazon RDS console, select Databases, and choose nextwork-db-cluster. Then, from the Actions drop-down menu, choose Delete.

  • 🚨 When deleting your database cluster, make sure to uncheck Create final snapshot and uncheck Retain automated backups so you don’t get charged.

Step 4: Uncheck the firest two options to avoid charges

Step 4: Uncheck the firest two options to avoid charges

DELETE EC2 instance: Open the Amazon EC2 console, select Instances, and choose the instance you created. Click Actions at the top, then Terminate instance.

  • Delete your key pair: Open the Amazon EC2 console, select Key Pairs, and choose the key pair you created. Click Actions at the top, then Delete Key Pair.

메타데이터
post_id
9ef8a7cdd7ad
slug
aurora-database-with-ec2-9ef8a7cdd7ad
url
https://medium.com/@jlouis26/aurora-database-with-ec2-9ef8a7cdd7ad
canonical_url
https://medium.com/@jlouis26/aurora-database-with-ec2-9ef8a7cdd7ad
author_url
https://medium.com/@jlouis26
status
ok
fetched_at
2026-06-26 21:52:29