Create and Connect to a MySQL Database
In this tutorial, you will learn how to create an environment to run your MySQL database, connect to the database, and delete the DB instance.
We will do this using Amazon Relational Database Service (Amazon RDS) and everything done in this tutorial is Free Tier eligible.
Step 1: Create a MySQL DB Instance
- Login to AWS and Select RDS as service. Please ensure that you are selecting the region where you want your DB to be hosted.
- In the Create database section, choose Create database.
- In the database creation method, Select Standard create
- Select MySQL in the Engine options and select the version of the MySQL database.
- Select Free tier in Templates section.
- You will now configure your DB instance. The list below shows the example settings you can use for this tutorial:
- DB instance identifier: Type a name for the DB instance that is unique for your account in the Region that you selected. For this tutorial, we will name it mysql-demo
- Master username: Type a username that you will use to log in to your DB instance. We will use Admin in this example.
- Master password: Type a password that meets the requirement.
- Confirm password: Retype your password
- Select db.t2.micro in the DB instance class
- Keep the default setting in Storage and uncheck the Enable storage autoscaling
- Make the following changes in the Connectivity section.
- Make the following changes in the Connectivity section.
- Virtual Private Cloud (VPC): Select Default VPC.
- Subnet group: Choose the default subnet group.
- Public accessibility: Choose Yes. This will allocate an IP address for your database instance so that you can directly connect to the database from your own device.
- VPC security groups: Select Create new VPC security group. This will create a security group that will allow connection from the IP address of the device that you are currently using to the database created.
- Availability zone: Choose No preference. See Regions and Availability Zones for more details.
- Port: Leave the default value of 3306.
- In the Additional configurations section, Configure as below:
- Database name: Type a database name. For the demo purpose, I am creating demo db.
- DB parameter group: Leave the default value.
- Option group: Leave the default value.
- Keep it default for the remaining settings and click Create database
- Your DB Instance is now being created. Click View Your DB Instances.
Depending on the DB instance class and storage allocated, it could take several minutes for the new DB instance to become available. The new DB instance appears in the list of DB instances on the RDS console. The DB instance will have a status of creating until the DB instance is created and ready for use. When the state changes to available, you can connect to a database on the DB instance.
- Your database is created now.
- You can connect to this database by using the Endpoint and username and password specified in this demo.
- You can monitor the performance of the database under Monitoring tab. This provides various CloudWatch metrics to track database performance.
- All the recent events and logs can be checked under Logs & events tab
- Play around the database by connecting it and see how the various metrics and logs are getting affected.
- Once done, you can delete the database by selecting the delete option from AWS console
- Acknowledge the deletion of the database
- Your database will now be deleted
AUTHOR - CHANDU
Comments
Post a Comment