Let’s say there is an app running locally on 8888 port (localhost:8888) and we want to make it available via the EC2 instance :8181. Use SSH tunnel to the EC2 instance (or any other machine that’s accessible from the Internet).Use service like which will do the forwarding from the Internet to your local machine.If you have the “real” IP address (you may need to ask your Internet provider to setup a real IP for you), you only need to make sure that your firewall allows connections to the port your app is running on.Sometimes it can be necessary to make locally running app available through the Internet. Example: Expose Local Server Through the EC2 Instance Similarly to the PostgreSQL example above, we can create an ssh tunnel to the EC2 instance that has Redis access and expose Redis locally: ssh my-ec2-instance -L 6379:id.:6379Īfter that, we can use redis-cli or any other tool on the local machine to connect to redis on 6379 port. The ~/.pgpass looks like this: localhost:5432:*:my_db_user_one:XXXYYY Note: both commands above don’t specify the database password, to make it work, the password can be specified in the ~/.pgpass file (so it will not be present in the shell history or visible on the screen when the command is executed). Here my-aws-host is the EC2 instance that has DB access and my-rds-host-name.cdiofumqrcpr.:5432 is the RDS host name and port.Īfter that, you can use the localhost:5532 on your local machine to connect to the remote database, for example with psql: psql dump the database with pg_dump: pg_dump -Fc -v -f my_db_name$(date -iso-8601).pq
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |