SuperHi FM

Intro to Full Stack Javascript

Get access to Intro to Full Stack Javascript

  • Practical, go-at-your-own pace learning, with help from our industry experts and experienced teachers
  • Projects and code that you can alter and include in your own sites and portfolio
  • Resources to get you started and going post-course
Lesson 04

Connecting to AWS using a database client

How do we make sure our AWS credentials are accurate and functional?

Ultimately, we need to use them in our application to connect to our database. But firstly we should figure out if they work, right? Just in case we're having any connection issues down the line.

To do that, we’ll use another database viewer.

These are kind of divisive tools - a lot of people don't like interacting with a database visually and they can be very slow if you have a very large database.

However, as a way of quickly visualizing whether the connection works and like what my data looks like I don’t think they can be beaten.

MySQL Shell

To do this, and given that we’re interacting with a MySQL database, I use a MySQL shell in my VSCode as an extension.

Other than the fact that it's made by Oracle and has good reviews, it's pretty much at random.I'm sure a lot of these different shell VS Code extensions will do the trick as well.

Once installed you’ll end up with a tab on your lefthand side that looks like a dolphin which, when clicked on, will take you to a screen where you can initialise a new database connection.

Creating a connection

In order to create a connection with our AWS database we need to provide it a few things.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris euismod imperdiet feugiat. Pellentesque elementum rhoncus justo eu maximus. Donec varius magna sed nisl posuere fermentum. Integer in orci placerat, egestas lacus a, pharetra tortor. Sed iaculis ac turpis sit amet semper. Nunc accumsan gravida tempus. Donec vel eros a risus condimentum ullamcorper ac eu mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tortor faucibus, egestas tellus ut, condimentum erat. Vivamus tristique aliquam purus.

We need to provide it:

  • a host

  • a protocol

  • a port

  • a caption (defined by you)

  • a name (defined by you)

  • We need to select whether you're using SQL or SQLite (SQLite is, as the name suggests, a very lightweight version of SQL - it can be useful for prototyping but I never really use it).

  • a username

  • and a password.

All those details are in the notes above.

Looking at the shell

And we will authenticate into our database. If the credentials work, you should end up here. You will be presented with a SQL shell.

We can see a table view of our databases on the left.

You will see multiple different databases going on.

We want to access the careful database, which has a few tables:

  • care recipients

  • caregivers

  • and events.

You can access the columns for each database, if you wish, just to get an understanding of what the data looks like, what it contains and what you can expect when pulling from it.

Interacting with the database using SQL

In the main VSCode panel we have a SQL command prompt.

Here we can run some simple commands in order to interrogate our data directly:

  • SHOW DATABASES ← allows us to show a list of all our databases

  • USE careful ← allows us to focus on the careful database

  • SELECT * FROM events ← is the syntax for selecting something from a given table. We can substitute out the events table for any other. * is a wildcard which allows us to access all the information.

To execute commands use CMD + enter on Macs and CTRL + enter on Microsoft PCs.

We won’t go too deeply into SQL here but much more on commands to use and get familiar with can be found here.

Transcript

00:00

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris euismod imperdiet feugiat. Pellentesque elementum rhoncus justo eu maximus. Donec varius magna sed nisl posuere fermentum. Integer in orci placerat, egestas lacus a, pharetra tortor. Sed iaculis ac turpis sit amet semper. Nunc accumsan gravida tempus. Donec vel eros a risus condimentum ullamcorper ac eu mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tortor faucibus, egestas tellus ut, condimentum erat. Vivamus tristique aliquam purus.

00:50

Nulla facilisi. Donec sed quam in dolor mattis condimentum. Proin mauris erat, laoreet et tellus vitae, iaculis interdum augue. Duis mattis nunc et felis facilisis lobortis. Pellentesque sagittis egestas neque. Vestibulum ultricies non libero at placerat. Quisque sodales eu lacus in molestie. Aenean tempor ac lacus id tincidunt. Curabitur lacinia condimentum elementum. Cras pellentesque, nibh auctor vehicula egestas, nunc purus molestie urna, eget maximus elit arcu id mauris. Nunc egestas congue dui, a posuere justo. Aliquam leo libero, lacinia at justo quis, tincidunt iaculis felis. Aliquam tempus varius vulputate. Donec porta, sem eu maximus viverra, turpis mi accumsan metus, gravida blandit mauris nunc sit amet massa.

01:41

Donec vitae diam id lectus faucibus tincidunt. Duis quis ipsum turpis. Donec facilisis sapien massa. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis hendrerit lacus quis odio maximus convallis. Mauris eu ultrices diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc eu ligula diam. Vestibulum a risus nec libero dictum rutrum in ac arcu. Maecenas commodo, quam non suscipit mollis, risus lacus maximus leo, sed interdum metus ante eget justo. Phasellus condimentum nisl diam, at lacinia turpis viverra in.

Private notes

A place for you to post notes about anything on this page. Only you can view your notes.

SuperHi FM

Want some ambient music in the background? Play our radio station!

Feeling stuck?

Don’t worry, we are here to help you with:

  • Speedy help from one of our team members
  • Detailed, relevant solutions
  • Direct access to peer support through Discord!

Remember, there’s no such thing as a silly question, so don’t hesitate to reach out, we love hearing from you!