Django with MySQL deploy on aws ec2 - django

I want to deploy my django with MySQL db for production on aws ec2. Files and db are present on the server.

follow the official docs http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html, start directly at "Configure Your Django Application for Elastic Beanstalk", since you have already developed your app

Related

How to host an API (written in Flask-SQLAlchemy) to communicate with a Docker-ized MySQL container?

Context
I have a backend and API written in Python and Flask-SQLAlchemy. I use Flask-SQLAlchemy to define tables for a MySQL database, and my API routes access these tables. Previously, all my development has been on my local machine and my Flask-SQLAlchemy communicated with a local SQLite database. I currently have a Docker container with a MySQL image which contains an empty MySQL database.
What I Am Trying To Accomplish
I would like to host this API online, as well as host the Docker container (which contains a MySQL database) online. The Flask-SQLAlchemy API should communicate with the hosted MySQL database.
Options I've Considered
To my understanding, there are several options to host my API and MySQL database online.
For my API, I can either host my API onto AWS Elastic Beanstalk, or onto Docker then onto EC2.
For my MySQL database, I would like to host it onto Docker then onto EC2.
The following is how I assume I can approach this:
Problem
Should I host my Flask-SQLAlchemy API on Elastic Beanstalk, or on Docker then onto EC2? My main goal is to have my hosted API talk to a MySQL database hosted on Docker.

How to add a SQLite database in AWS?

I have created a flask application that uses a sqlite database in local system. It works fine.
I wanted to deploy this application on AWS on Elastic Beanstalk service. The application is deployed successfully using GitHub actions and Elastic Beanstalk. However, when I try to access the database, it shows Internal Server Error.
I know that to locally create the database, we need to run the following 3 commands -
flask db init
flask db migrate -m "Message"
flask db upgrade
But where should I mention and run these commands in Elastic BeanStalk? Should I mention them in the main.yml file?

Containerised Web Application which connects to Relational DB

Can anyone point me in the direction of some demo code/app that I can use for a demo.
The app should have the ability to connect to a relational database and ideally be able to demonstrate the persistence of having the DB.
I.e. You can save values into the DB from the web app
I'm planning to deploy this onto AWS ECS for testing, alongside RDS.
Thanks in advance
Here is an AWS tutorial that shows how to write a Java Spring Boot Web app that is deployed to Elastic Beanstalk ( Elastic Beanstalk is an AWS service that leverages Amazon EC2 and S3 and deploys, manages and scales your web applications for you. It uses managed containers that support Node. js, Java, Ruby, Docker and more) and uses RDS to store and update data.
Creating the Amazon Relational Database Service item tracker
So most of what you are looking for is there - including how to setup the RDS instance and interact with it from a web app deployed to the cloud. If you follow this step by step (there is a lot of Java code) -- you will get this Sample Web App running on the cloud and it will teach you how to interact with RDS from a web app.
Also - this covers invoking additional services such as Simple Email Service from the web app.

How to establish WebAPI for Amazon RDS SQL Database?

I am working on Xamarin Mobile App for which we are using SQL 2012 as Server Database. DB is already hosted in Amazon RDS. However, I am not clear on creating WebApi for the database.
How to establish WebAPI for Amazon RDS SQL Database?
I DO suggestion to create an API as this can serve as the interface between your database and your Xamarin Mobile App.
You could use AWS Elastic Beanstalk for the hosting. This guide shows you wow to work with .Net and RDS and later be able to deploy it on Amazon.

Django Amazon aws readonly database error

I have developed a Django project on a local server using PyCharm with Apache server. Now I deployed project on the Amazon AWS Elastic Beanstalk, but when I am trying to register a User (using standard django User model) I get exception:
attempt to write a readonly database
Can anyone give a hint how can I fix this?