- Newest
- Most votes
- Most comments
Hello,
In this case, you'd need to make sure port 3306 is exposed on the database container (similar to how port 80 is exposed on your web container). Then, you would be able to access the database container from the web container via localhost:3306.
Unfortunately, there's not a way to stop this from exposing other Lightsail resources from accessing this via private domain (ie, via my-service.service.local:3306). You'd need to update the database container to not accept traffic from outside of localhost. I'll mention that if you have VPC Peering disabled on the Lightsail console, only your other Lightsail resources would have access to it; your resources from other AWS services wouldn't be able to access it.
Additionally, in case you are not aware: if you're running this service with a scale greater than 1, each node will have both containers and will be running independently of the others. This means you'd have multiple databases (one per node) and each node would only communicate with its own database.
Thank you for using Amazon Lightsail!
-Maxwell
Thank you for reply.
It is very confusing that Lightsail does not work like usual Docker PaaS. Would be nice to clarify this in docs. :-)
Also thank you for note about scaling. This reminds me similar issue I faced: How to communicate with another containers on another nodes? I need it for Memcached, so app can invalidate cache on all instances, not only its. I am not locked to Memcached, I can also use Redis, if Lightsail has this synchronisation solved somehow.
Thank you for your feedback about our docs. I'll forward this along to the team.
I don't believe there's a way to communicate between containers on different nodes. The way to achieve what you want would be to create separate container services with memcache/redis, or create Lightsail instances with memcache/redis, then refer to them on your web container by their private endpoints. Lightsail instances might make more sense since the storage is not ephemeral.
Thank you for sharing your use case. We're constantly looking for ways to improve our service, and feedback like this is always useful for us.
Best,
Maxwell
Strange. Does it mean that official Redis template results in an inconsistent cluster when scaled up?
Relevant content
- asked 2 months ago
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 7 days ago