Labs9-FlightLog uses Amazon Web Services Relational Database Service (RDS) as our database management.
An account can be created at AWS. A new account can be created or use your existing Amazon account.
It is important to document the following information and save it in a location (not in your code) where you can access it if needed.
- DATABASE INSTANCE NAME (not the same as db name)
- DATABASE HOST ADDRESS
- DATABASE USERNAME
- DATABASE PASSWORD
- DATABASE NAME
- DATABASE PORT
- Sign into the AWS Management Console and in the
Find Services
search bar, enter RDS (for Relational Database Service). - Look for
Create Database
at the center of the page and select the orangeCreate database
button. - Select
MySQL
, NEXT. Specify Database Details
, scroll down to settings. Enter yourdatabase instance identifier
,master username
andmaster password
. DOCUMENT THESE CAREFULLY and ACCURATELY! NEXT.Configure advanced settings
, scroll down toDatabase options
. Name your database.
DOCUMENT THIS and thePORT
!DATABASE NAME
IS DIFFICULT TO FIND ONCE YOU LEAVE THE PAGE!- Scroll to bottom of page and create database.
Our database was populated using KNEX. Visit this section of the documentation to see how this was completed and the dependencies need. HERE
Create an .env
and add it to your .gitignore
. Populate your KNEXFILE like you see in the example below.
development: {
client: "mysql",
connection: {
host: process.env.AWS_HOST,
port: process.env.AWS_PORT,
user: process.env.AWS_USER,
password: process.env.AWS_PASS,
database: process.env.AWS_DATABASE
},
useNullAsDefault: true
},
production: {
client: "mysql",
connection: {
host: process.env.AWS_HOST,
port: process.env.AWS_PORT,
user: process.env.AWS_USER,
password: process.env.AWS_PASS,
database: process.env.AWS_DATABASE
},
useNullAsDefault: true
}
};