This is a relatively quick setup for MySQL 5.7.14 on Red Hat Enterprise Linux version 7 (RHEL7).
I am not affiliated with AWS; I just enjoy using their services.
Make sure you have an AWS EC2 account. Please note that although Amazon requires a credit card in the file, there will be no charge for the first year if you adhere to the Free-level> terms . Typically, this means that one micro-instance (1 GB RAM) server is running 24/7.
Starting an EC2 RHEL Instance
Step 1: On AWS EC2, click “Run Instance” and select “Red Hat Enterprise Linux 7.2 (HVM), SSD volume type is ami-775e4f16,” as shown in the figure below. Please note that versions of available or advanced AMI (Amazon Machine Instance) will rotate over time, and this is at the time of this writing. But the AMI number is shown in the text above.

I usually chose Amazon Linux AMI as my distribution. I do not do this anymore, since this is their own hodge-podge, and, of course, there is uncertainty in the choice of a package manager and, therefore, files. So, I stick with RHEL.
On the Select Instance Type screen, select an instance type of the appropriate type, as shown below:

Click "Next." On the next Details screen, click Next to accept the default values. On the storage screen, resize to 16 GB and click Next. Then "Next" again in the tag. Next is the Configure Security Group screen, shown below:

Accept the switch "🔘 create a new security group" at the moment. Note. The SSH 22 port is open to all (Anywhere) IP addresses with 0.0.0.0/0 CIDR . Other options include detecting "My IP" (as in yours) or "Custom". Be sure that the next time you access the screen it will be blocked based on the security keys that we install. There is a button to add a rule in open ports to add ports such as MySQL 3306 or HTTP 80. But for now, we will skip this. Note the name of the security group. Fill it out or accept the default value. It is not so important that this is correct, since the security group can be changed later for the executable instance. Click Browse and Launch.
Then click "Run" (do not be afraid, it does not start yet). As shown in the following screen:

Please note that since I already have several keys generated, the default is “Select an existing key pair” in the first drop-down list. Otherwise, you will create a new key pair with the specified reminder name and proceed to the "Download key pair" section. At this point, you have a key pair as a .pem file. Treat this with maximum safety, keeping it in a place that you won’t lose. Preferably in a password protected area, for example, in the directory of your user operating system.
When you finally click on "Launch instances" on the same screen, the launch occurs in relation to this key pair (either just created or already existing). Please note: generating a key pair can be a task that you perform only once a year. Reusing a key pair again and again, right up to you.
After starting the instance, you have about five minutes before it appears live. In the “Instances” menu item, you know that the instance is in real time when the state of the instance reads “running” and “Status Checks” reads “2/2 passed”:

Remember the downloaded .pem file? Well, just once you need to create a .ppk file from this for PuTTY, the SSH client program that will communicate with the cryptographic protection of your executable instance. To do this, we use the puttygen tool, which works in accordance with PuTTY. So, we run puttygen, load the .pem downloaded minutes before and generate the .ppk file with the key phrase of the key, such as "I and love% ancHovies2_fjdi8Ha". The following is a picture of puttygen:

And an AWS EC2 page called Connecting to your Linux instance from Windows using PuTTY , the steps are the File / Load Private Key. Change the filter to all files (.). Find the .pem file. Click "Open," then "Good." Enter a passphrase. Click "save private key" and save it in the same folder as the .ppk file, next to your .pem file. As already mentioned, this is not something you can do, but every year.
Now run PuTTY, the SSH client. Use session / host name something like
ec2-user@ec2-www-xxx-yyy-zzz.us-west-2.compute.amazonaws.com
Thus, basically ec2-user@ combined with the public DNS name, which is displayed in the "Instances in EC2 Control Panel" section. As for specifying the PuTTY .ppk file, it will look like this: the .ppk file selected next to the Browse button:

Return to the previous hierarchy of the session shown below, specify this profile name in the Saved Sessions section, and click Save. Later, when you download PuTTY, you simply load the session by name:

Remember that almost everything you do here saves the .ppk link to a friendly named profile. And you may need to change the host name (of course, when you save the instance image to EC2 and return with the new IP address of the instance the next time you start it).
Well, that’s not easy. But that is what it is.
When you click Open, it will try to connect to your RHEL instance. Click "Yes" in the signature warning. Enter the pre-saved .ppk and you should sit on the Linux command line.
Installing MySQL (I'll post these notes on GitHub)



URL01: Download MySQL Yum repository
URL02: Chapter 1 Installing MySQL on Linux Using the MySQL Yum Repository
Now you download and run MySQL 5.7.14 on EC2 with the database and user settings. Your servers must be mapped. Here is this answer here for image creation (AMI). Data backup. See EC2 Documentation, for example, Recommendations for Amazon EC2 .
Back to security: best practices, of course, suggest not opening your db for direct connection through security groups for port 3306. How do you decide to stick to this - your choice, for example, with PHP, Java or another programming API. Note that various db client programs can connect through SSH tunnels such as MySQL Workbench. In addition, there are various development libraries with SSH tunnels, but they are not so easy to develop (mainly due to complex key chains and the lack of extensive developer experience). For example, there is one for C # here .
In addition, AWS has RDS and another database for less practical work and for your own, as above. The reason many developers are targeting EC2 is because you have a complete server for other software initiatives.
If you are modifying security groups as mentioned earlier, consider using IP ranges based on CIDRs and be careful before overexposing your data stores. Or for providing. Almost the same best practices as for on-site work.
Regarding this MySQL section, my GitHub notes for the above images are located here .