From the local machine, use the available port from step 1 (port 9090 in this example) to access the database. Note: In the preceding example, port 9090 is available on the local machine.Ģ. It presents in your local machine on port 9090. This command uses Session Manager-based SSH and establishes a tunnel to port 3306 on instance2. From a local machine (for example, your laptop), run the following SSH command to connect to instance1. Instance2: An EC2 instance that's running MySQL Database on the default port 3306 Hostname =, Instance id = i-0123456789abcdefa Instance1: An EC2 instance that acts as a bastion host and is managed by AWS Systems Manager The database must run on an EC2 instance and use the SSM host as a bastion host. Example configuration: Use SSM host as a bastion host to create a tunnel from a local machine to a MySQL databaseĬreate a tunnel from your local machine to access a MySQL database. In the preceding example, 127.0.0.1 and localport translate to access targethost:destport. Run the following command to test access to the tunnel on the target port that you created: telnet 127.0.0.1 localport Run the following command to start the SSH tunnel: ssh -i /path/my-key-pair.pem -L localport:targethost:destportĢ. To use Session Manager to start the SSH tunnel, complete the following steps:ġ. Note: If you receive errors when running AWS CLI commands, make sure that you're using the most recent version of the AWS CLI.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |