Can we set up a database on Amazon EC2 similar to how XAMPP is configured on my local system - mysql

Can you install MySQL for AWS Elastic Cloud Compute (EC2) directly on the instance? I can't afford to purchase a separate RDS instance at the moment.
My website is setup on AWS EC2 already and now I'm going to try out some features with a database. I need to set up the instance to run on the EC2 localhost and connect it to my website to store my user data.

So first you need to separate XAMPP from mysql in your thought process. XAMPP is a tool only for your local development. You can set up a database on the Elastic Cloud Compute (EC2) instance similarly to how you set up your XAMPP config locally.
Here are the official docs on how to install a full LAMP stack on an EC2 instance running the Amazon Linux AMI - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

Related

What after connecting AWS database and MYSQL WorkBench?

I need proper explanation and steps to connect to an RDS database from my AWS Elastic BeanStalk Project. I have already created a RDS instance on AWS and successfully connected to it from MYSQL Workbench. After that, I have also connected it to my Elastic BeanStalk project. But still my java based website project cannot fetch data from it. Why ????
This use case is documented here:
https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javav2/usecases/Creating_rds_item_tracker
This tutorial steps you through creating a Java Spring app that is deployed to AWS Elastic Beanstalk and queries data from an RDS instance.
Please check if you can access your RDS instance from your elastic beanstalk environment when you set the RDS instance to public. If you can you have not configured your security groups to allow connections from your EB environments towards your rds instance.
Note: don't forget to set it to private again after you're done with testing.

Can AWS Aurora Serverless Clusters be configured via AWS Explorer in DataGrip?

I'm currently having issues setting up the AWS Explorer plugin in DataGrip to recognise the Aurora Serverless Clusters (MySQL). I have set up credentials from IAM in the credentials file, and can access other AWS services (if I select the dropdown "Schemas", for example, I can see the list of schemas in my org) but clicking the RDS dropdown shows "empty", and doesn't even show the list of database engines. I have tried connecting with secrets manager and using the correct secret for the DB cluster but no luck. When I try and add the database cluster as a data source, it just hangs on "Introspecting" and then the endpoint for that cluster.
I found this issue on the aws-toolkit for jetbrains github https://github.com/aws/aws-toolkit-jetbrains/issues/2124
which mentions that it could be a driver problem. I have tried changing to the mySQL driver, and that hasn't seemed to fix it. DataGrip also seems to heavily encourage using the recommended Aurora MySQL driver.
Is this a bug with DataGrip, or AWS Explorer, or am I missing something obvious? Do I need to enable SSL CAs to get AWS Explorer the correct permissions?
Thanks!
EDIT: I have gone through the prerequisites listed on the AWS docs:
I have installed the AWS CLI and AWS SAM CLI
I have installed Docker (but I haven't set up any containers - I think this is
only needed if I'm running localhost?)
I'm running Windows 10.
Aurora serverless can't be accessed from the internet. From docs:
You must create your Aurora Serverless DB cluster in an Amazon Virtual Private Cloud (Amazon VPC). Aurora Serverless DB clusters are accessible only from an Amazon VPC and can't use a public IP address.
Thus, you need to setup VPN or some proxy (e.g. ssh tunnel through a bastion host) to be able to connect to Aurora serverless from outside of AWS.

Connecting to MySQL server via kubernetes pod using Intellij

We have a MySQL server that is running on AWS using AWS RDS service and some Kubernetes pods which run some services that connect to this MySQL instance.
I have been using Intellij Idea (2020.1) to connect to these MySQL servers for quite some time. However, recently we have changed the policy to connect to these instances, and now it's only possible to connect to the MySQL servers from the Kubernetes pods. Hence, I now need to login to these pods and then query MySQL using the command-line MySQL-client.
Is there any way I can still use Intellij to connect to these MySQL instances than having to log in to the pods using something like SSH tunnelling or something like that?
Yes, setting up an SSH tunnel is recently straight forwards, but the setup depends on your VPC and EC2 configuration. There are a lot of how-tos on the net, e.g.: https://medium.com/#michalisantoniou6/connect-to-an-aws-rds-using-an-ssh-tunnel-22f3bd597924

Custom Amazon EC2 instance and managing MySQL

so I've made an instance at amazon free web service, I've installed through putty mysql, php5, apache and so on on an ubuntu instance... But I can't for the life of me seem to find out how to manage the mysql on that instance. What am I missing? If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
As you have installed MySQL in the EC2 instance you can manage it via terminal.
Login to your instance using putty/ssh and connect to MySQL using below command
mysql --user=username --password=password
you need to install MySQL client if you installed on only MySQL Server.
If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
Yes, RDS is a service where Amazon manages the entire database box for you. The AWS Console manages (paid) RDS instances, not databases in general.
But I can't for the life of me seem to find out how to manage the mysql on that instance.
The "normal" way. Amazon doesn't come with CPanel or other GUI administration tools. Mainly because experts don't need them.
If you want to manage your MySQL graphically, install something like PHPMySQLAdmin or the like.
Note: never open the MySQL port to the internet. If you need to connect to MySQL, use "port forwarding" in Putty to forward port 3306 to the remote box port 3306. Then you can run a MySQL GUI client locally.

Trouble connecting Heroku App with Amazon RDS Instance

I'm using Amazon RDS for the first time ever and I've been following the heroku docs to get my app using the RDS instance. So far I've created an instance and I have setup the addon using the format:
$ heroku addons:add amazon_rds url=mysql://user:pass#rdshostname.amazonaws.com/databasename
After running heroku rake db:migrate I got
!!! The bundled mysql.rb driver rake
aborted! no such file to load -- mysql
So I installed the MySQL gem. Doing the same thing again I got the error:
Can't connect to MySQL server on
'myapp.cqslpaxxqrok.eu-west-1.rds.amazonaws.com'
(110)
I see there's a note about the instance being in the US-east region for Heroku's security group to control access or something. Can I not use a European instance?
No, you cannot use a European instance. Heroku is only available on the US East zone right now, and you need to be able to add Heroku to your security zone for the RDS instance to work, which I suppose require you to be in the same zone. More imporantly, you want to be in the same zone as Heroku for latency and security reasons (otherwise your database traffic will be travelling over the Internet).
Heroku changed its procedure to allow Heroku servers to connect to RDS instances. The accepted answer to this question is not true anymore.
You have to grant Heroku dynos access to your RDS instance. The recommended way to do this is to configure the RDS instance to only accept SSL-encrypted connections and configure the security group for your instance to permit ingress from all IPs.
Previously, Heroku published its AWS account ID and security group name as a way to grant access to an AWS RDS instance. This is no longer recommended.
Ref: https://devcenter.heroku.com/articles/amazon_rds