Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS ECS mysql DB instance

Hey I wanted a design answer regarding using MySQL database in AWS ECS container . I'm not using RDS as currently doing some MVP. Is it possible to use Mysql DB as a docker container, and if it is so, then how do i make sure prod data is persisted when deployment happens of this DB container.

Please guide me for this scenario.

like image 648
Prashant Avatar asked Oct 01 '17 19:10

Prashant


People also ask

What is MySQL database instance?

A server instance is a MySQL server running somewhere, and also how to connect to it. See the reference manual, which says: A server instance is created to provide a way of connecting to a server to be managed.


1 Answers

Yes, entirely possible.

Explaining it from start to finish is way too much for an SO answer. AWS has thorough documentation on ECS, and I would recommend starting there: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html

The section concerning data persistence is here: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html

The thing to remember with volumes and ECS - named volumes are for sharing data between containers; hosted volumes are for persisting data beyond the lifecycle of any number of containers. So you'll want to mount a volume from the underlying EC2 instance into the container where the MySQL data is stored.

Depending on which MySQL image you choose, the container data directory might differ. Any image worth it's salt is going to tell you where this directory is located in the README, because that is a very common question with databases + Docker.

like image 102
bluescores Avatar answered Oct 11 '22 01:10

bluescores