Can't Connect to RDS mysql DB from Wordpress on Ubuntu 18.04 EC2 Instance - wordpress

I'm trying to run Wordpress on my Ec2 instance with RDS MySQL database.
Here's the tutorial I've followed https://cristianocastro.net/instalando-wordpress-em-um-servidor-amazon-aws-pt-2-3/
But when I try to access the Ec2 instance that connect to the RDS on the browser it shows this message
Error establishing a database connection
I put in the security group inbound and outbound all traffic anywhere.
Here's the print from my security group rule.
Appreciate the help
PS: Saw this question, with no anwser Can't Connect to RDS mysql DB from Wordpress on Amazon linux EC2 Instance
Edit: Rules from security group of the ec2 instance that will access RDS.

Based on the info you provided it seems your RDS is publicly accessible via the internet and connections are going to be accepted from any host (you might want to restrict these later)
Assuming that your software setup (OS, php, MySQL libraries, Wordpress) is okay and you’re using the right parameters in the WP configuration (host, port, user, password, db).
One of the remaining issues might be that the Security Group attached to your EC2 instance doesn’t allow connectivity on port 3306 (MySQL) towards the IP Address of your RDS instance.

It appears that you have:
An Amazon EC2 instance
An Amazon RDS instance
The typical security configuration would be:
The Amazon RDS database configured as Publicly Accessible = No
A Security Group (EC2-SG) on the Amazon EC2 instance that permits inbound traffic from your desired locations (eg port 22 for SSH), and default Outbound rules permitting all traffic outbound
A Security Group (RDS-SG) on the Amazon RDS database instance that permits inbound traffic on port 3306 from EC2-SG
That is, RDS-SG should specifically reference EC2-SG to permit the inbound connection.
The app running on the EC2 instance should reference the RDS database via the DNS Name shown in the RDS console.

Related

Unable to access newly created Airflow UI MWAA

I am trying to create MWAA as root user and I have all AWS services (s3 and EMR )in North California. MWAA doesn't exist in North California. Hence created this in Oregon.
I am creating this in a private network, it also required a new s3 bucket in that region for my dags folder.
I see that it also needed a new vpc and private subnet as we dont have anything in that region created by clicking on "Create VPC ".
Now when I click on airflow UI. It says
"This site can’t be reached". Do I need to add my Ip to the security group here to access Airflow UI?
Someone, please guide.
Thanks,
Xi
From AWS MWAA documentation:
3. Enable network access. You'll need to create a mechanism in your Amazon VPC to connect to the VPC endpoint (AWS PrivateLink) for your Apache Airflow Web server. For example, by creating a VPN tunnel from your computer using an AWS Client VPN.
Apache Airflow access modes (AWS)
The AWS documentation suggests 3 different approaches for accomplishing this (tutorials are linked in the documentation).
Using an AWS Client VPN
Using a Linux Bastion Host
Using a Load Balancer (advanced)
Accessing the VPC endpoint for your Apache Airflow Web server (private network access)

Run symfony command on separate VM

I have an application running Symfony 5.2 on apache ubuntu 18.04 vm (vm1). Users are uploading assets to the application that are at first stored in filesystem. I then have a symfony command triggered on cronjob that will:
read from fs and read from db
manipulate assets using terminal commands
upload to separate storage
remove assets from filesystem and update db.
The command is quite heavy so I would like to run it on a separate vm to avoid impact on user experience. My question is how to best achieve this.
My current thinking is that I can
Disable command on vm1
Setup new vm (vm2) with same codebase. Trigger command with cronjob on vm2
Somehow allow communication between vm1 and vm2 (i guess both in same private network)
Somehow allow vm2 read/write access to fs on vm1 (could probably be done by setting up nfs on vm1 accessed by vm2)
Somehow allow vm2 read/write access to mysql db on vm1 (i guess open port 3306 to vm2's private ip)
Is this the best way forward or does symfony have some support to better achieve this?

EC2 cannot connect to mySQL RDS

I've tried this a couple of times without any luck. I've got a new EC2 instance (Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-0a0ad6b70e61be944). This instance is in the default VPC and region = US EAST 2 (Ohio). The EC2 is in a web-server security group that has inbound ports 80 & 22 open. The RDS is a MySQL instance "Dev/Test" and is in a security group that has has inbound port 3306 open for "my ip" and my web-server security group is added to this DB security group. I can SSH into my web-server without issues. I can launch my test page on my web-server without issues. Yes, I'm using the correct connection string details including credentials.
However, the WordPress client on my EC2 fails to connect to my RDS with the following error:
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at uday.cgakf6jnokhj.us-east-2.rds.amazonaws.com. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?
Any help would be appreciated
I've tried suggestions like directly adding the public and/or private IP of the EC2 into the Security Group of the RDS - no luck :-(
The tutorial in udemy had wrong instructions. This particular paper in AWS helped me overcome underlying issues - everything now works beautifully!! https://aws.amazon.com/getting-started/hands-on/deploy-wordpress-with-amazon-rds/5/
Thanks!

How to launch PhpMyAdmin or MySQL Workbench for an AWS Ec2 WordPress instance?

I launched a WordPress instance in EC2 in AWS. Now I can access WordPress Dashboard. But how to access database? If I install WordPress in my PC I can easily access it via a local-host link. From AWS how can I access the same? Also, is there any possibility to connect the MySQL database via MySQL Workbench?
Thanks
Venkat
Venkata, you are able to access WordPress hosted on EC2 because the http port and https port is open in the firewall, check your inbound settings in security group.
You can access your MySQL Database hosted in same EC2 instance (in this specific case) if you can open the port for access, in inbound settings. Make sure you have a MySQL user created and you have user name and password for the user.
First On EC2 instance you have to configure complete LAMP stack and than you have to open the port from security groups from AWS console admin.
After installing LAMP stack and opening port you have to place adminer.php file on the /var/www/html directory or the directory where you installed the wordpress.
after that you can access the database and the wordpress

Access publicly accessible service on host from Dokku guest

We are converting to Dokku, and as a part of this process the database (PostgreSQL) will remain running directly on the host for the time being.
The database is used by serveral servers spread around the Internet and accessible using its public IP.
I can psql to it from any server, including the server where it's hosted.
However, from inside the Dokku guest running on the same server I get timeout. It would appear somewhere access to it is being blocked.
Any thoughts on why this is happening?

Resources