Skip to content

Commit c5212a5

Browse files
authored
Merge pull request #7 from jniechcial/DOC-add-ec2-elasticache-example
[DOC] add ec2 & elasticache example usecase
2 parents 090f309 + f7b9144 commit c5212a5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,33 @@ ENV['ssh-tunnel'] = {
159159

160160
NOTE: at this time, this plugin does not support setting a path to `privateKeyPath` to a key that has been encrypted with a password.
161161

162+
## Using `ember-cli-deploy-ssh-tunnel` with "bastion" servers
163+
164+
`ember-cli-deploy-ssh-tunnel` is commonly used to open a tunnel on a "bastion" server in order to access services behind a firewall. A discussion of the problem is available on the README for the [`ember-cli-deploy-redis`](https://github.com/ember-cli-deploy/ember-cli-deploy-redis#what-if-my-redis-server-isnt-publicly-accessible) plugin.
165+
166+
### Example: AWS ElastiCache & EC2
167+
One of the common use cases for `ember-cli-deploy-ssh-tunnel` is need to connect to ElastiCache that is accessible only from EC2 instance. To deploy your `index.html` to ElastiCache you need:
168+
* username and host you can SSH into your EC2 instance (e.g. `deploy@my-ec2-instance.amazon.com`)
169+
* host and port of your ElastiCache that is accessible from this EC2 instance (e.g. `my-elasticache-instance.amazon.com:6379`)
170+
171+
First, you should confirm that ssh tunneling actually works on your localhost, try:
172+
173+
```
174+
$ ssh -f -N -L6379:my-elasticache-instance.amazon.com:6379 deploy@my-ec2-instance.amazon.com
175+
$ redis-cli
176+
```
177+
178+
You should be able to see Redis CLI connected to your ElastiCache instance.
179+
180+
If it works, set following configuration in `ssh-tunnel`:
181+
182+
1. Set `host` to your EC2 instance (e.g. `my-ec2-instance.amazon.com`)
183+
2. Set `username` to your EC2 user (e.g. `deploy`)
184+
3. Set `dstHost` to your ElastiCache instance (e.g. `my-elasticache-instance.amazon.com`)
185+
4. Set `dstPort` to your ElastiCache port (e.g. `6379`)
186+
187+
In `redis` config leave `host` and `port` as default - thanks to ssh tunneling your `localhost:6379` will point to `my-elasticache-instance.amazon.com:6379` via `my-ec2-instance.amazon.com`.
188+
162189
## Running Tests
163190

164191
* yarn test

0 commit comments

Comments
 (0)