AWS RDS MYSQL Playground

Do you need a reliable database platform to hammer out some new application ideas?

Or, maybe you’d like to learn MYSQL in a disposable environment?

This Hashicorp Terraform MYSQL RDS Module will build all the required AWS VPC networking, Security Groups, and RDS fundamentals in an average of 5 minutes to create, and allow you to connect to a MYSQL database from your home workstation.

Some Prerequisites:

Basic Steps:

git clone https://github.com/dps3ven/terraform-aws-rds

cd terraform-aws-rds

terraform init 

terraform plan

terraform apply -auto-approve

cat mysql_login

Copy the contents of the mysql_login output into the same terminal window

If all goes well, you should see the following:

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

If all does not go well, try the following:

Verify mysql client:

mysql --version
mysql  Ver 14.14 Distrib 5.7.34, for Linux (x86_64) using  EditLine wrapper

Verify AWS authentication:

aws s3 ls
# should return no error

Out of the box, the module does allow you to specify both the database password and the public IP address of your workstation. There are defaults for these variables, but I recommend using those that are specific to you.

See both the README from the module and Hashicorp Terraform Variable Declaration

In a production environment, the database password would of course not be directly entered as a variable in the configuration. Ideally, the secrets would be generated in a different CICD pipeline. For the purpose of this module however, AWS Secrets Manager is leveraged to create, store, and retrieve the database password. This is meant only to be a sample of how to use secrets.

When finished, don’t forget to run:

terraform destroy -auto-approve

About the Author

Dan Peterson profile.

Dan Peterson

Sr Consultant
Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Infrastructure as Code – The Wrong Way
You are probably familiar with the term “infrastructure as code”. It’s a great concept, and it’s gaining steam in the industry. Unfortunately, just as we had a lot to learn about how to write clean […]
Snowflake CI/CD using Jenkins and Schemachange
CI/CD and Management of Data Warehouses can be a serious challenge. In this blog you will learn how to setup CI/CD for Snowflake using Schemachange, Github, and Jenkins. For access to the code check out […]
How to get your pull requests approved more quickly
TL;DR The fewer reviews necessary, the quicker your PR gets approved. Code reviews serve an essential function on any software codebase. Done right, they help ensure correctness, reliability, and maintainability of code. On many teams, […]
Kafka & Kubernetes: Scaling Consumers
Kafka and Kubernetes (K8s) are a great match. Kafka has knobs to optimize throughput and Kubernetes scales to multiply that throughput. On the consumer side, there are a few ways to improve scalability. Resource & […]