my question is pretty similar to Two way syncing between on-premise SQL Server database and Azure SQL database
but i want it between my on premises mysql and AWS RDS instance.
So functional need is when i am within organization connected to local server (without internet) i will access localhost database (hosted on premises server) and from outside of organization i will access websize which is hosted on ec2 and ec2 will be connected with RDS database. so this both database needs to be in continues 2 way synchronization. i checked AWS DMS but i think it follows master db and slave db approach in which i can update RDS from on premises. what could be the solution, if it is possible with AWS DMS only than please guide me.
Your question covers a very complex subject with many issues that need to be considered before deciding on a solution. Factors such as the amount of data changing per interval of time, network connection bandwidth and latency, network connection reliability, data security, authentication, authorization, backup and recovery procedures, fail over and fault tolerance are just the start.
This article from Amazon discusses replicating a MySQL database hosted on-premises to RDS. An interesting tidbit from this article is:
The Road to Replication If you have read this far and you have some
experience with MySQL replication, you may be thinking “Cool — I can
set up replication from my existing database to the cloud, creating a
hot spare for easy failover.”
It is best to think of replication as a component of a fail-to-cloud
model, rather than as a complete solution in and of itself. Because
there’s a network connection in between the master and the slave, you
would need to monitor and maintains the connection, track replication
delays, and so forth in order to create a robust solution.
Migrate On-Premises MySQL Data to Amazon RDS