# Connecting to an instance via Bastion Host

**URL:** <https://forum.ansible.com/t/connecting-to-an-instance-via-bastion-host/16628>\
**Category:** Ansible Project\
**Created:** [October 28, 2014, 9:23pm UTC](https://forum.ansible.com/t/connecting-to-an-instance-via-bastion-host/16628 "2014-10-28T21:23:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Brown](https://avatars.discourse-cdn.com/v4/letter/b/8c91f0/32.png) [@Bob\_Brown](https://forum.ansible.com/u/Bob_Brown)\
**Post date:** [October 28, 2014, 9:23pm UTC](https://forum.ansible.com/t/connecting-to-an-instance-via-bastion-host/16628/1 "2014-10-28T21:23:14Z")

</div>

So I have Ansible setup in a local machine.  
My local machine has ssh access to a Bastion Host, essentially an ec2 instance that I can ssh to directly with my keys  
The instances I want to update/change/create all need to be accessed from the Bastion Host since it has the Nat to connect into the VPC

For both the command line and for a playbook, how do I set things up so that I can run a command or a playbook across many hosts but start the process from my local ansible box?

Bob

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 30, 2014, 8:35pm UTC](https://forum.ansible.com/t/connecting-to-an-instance-via-bastion-host/16628/2 "2014-10-30T20:35:45Z")

</div>

Basically you can set up ProxyCommand via ~/.ssh/config if you want to do this (see Google, etc).

Otherwise, you could also run Ansible from that Bastion Host by logging into that machine first and running Ansible there.
