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.
- AWS Account (region us-east-1)
- Hashicorp Terraform Installation
- MYSQL client installation
- Interest in learning some MYSQL
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