Reputation: 445
I am writing MySQL code using Python using MySQL Connector. Code is -
I have implemented this locally, and it is working properly. Now I want to deploy this file on AWS server. Its not working over there. What changes should I make, so that this code work on AWS server as well.
Thank you!!
Upvotes: 0
Views: 162
Reputation: 501
@Mayank Raj's answer is right, although I want to add something. if you want to deploy database server on RDS or any other server make sure you allow Port 3306 (MySQL Port) in the security group of EC2 instance.
Upvotes: 1
Reputation: 1624
Depending on where you are hosting the database, the connection details would change accordingly:
host
will still be localhost
and you have configured the credentials appropriately. In cloud enviornment this is not recomended for various reasons - if your instance goes down, the database goes down as well and more importantly you will have to manage the database which includes things like backups, mirroring, scaling etchost
. As for authentication, you can go the normal route of configuring username
and password
when configuring the instance.RDS is the recomended way to go as being a managed service, you offload a lot of heavy lifting that comes with managing a database to AWS. If you are starting out, RDs also Free Tier bundle (link)
Note: While provisioning the RDS instance or whike updating it, be sure to mark the option of "Enable Internet Access". This will make it possible for you to access the database via the internet eg outside the VPC, from your home etc
Upvotes: 3