Bastion Host | Jump Server
Published: 2022-01-25 07:46:00

## **_What is a Bastion Host ?_**
- A bastion host is a server whose purpose is to provide access to a private network from an external network, such as the Internet. Because of its exposure to potential attack, a bastion host must minimize the chances of penetration.

## **_Why to use ?_**
- If we want to SSH into EC2 instance on the private subnet from our home/office (or using a development machine), currently we can’t. Our instance has no public IP, it is in a Private Subnet (no direct route from the internet). This is where we can use a Bastion Server or Jump server.

## **_The purpose of a bastion host_**
- To restrict access to a private network from an external network.

**_Now lets us deploy a window server [disable public ip]_**

- Search for Ec2
- Launch instance
- choose T2micro[free tier]

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6cevoh7lsnfaaqdh34w.png)

- Disable public ip. [as we never provide a public ip to our database]

- add storage

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcsly6bc8uzbt5ml5g65.png)

- add tags

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jmjp5e1uk3bxzce4nlrn.png)

- Name the instance as Database or anything you want.

- next configure security group

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcfsmim341933gtcnf6z.png)

- select all traffic and anywhere [generally this is not a best industry practice , we only allow custom ips]

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvsinzx6loz493g720mk.png)

- now download the key pair and launch

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvdg4ofj0lymhjx2mrxk.png)

- decrypt the password

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xxn0wcz4qsoeyuxqlndt.jpg)

- download remote desktop and paste private ip ..

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/km9aog3m6ri9upwax4xm.png)

- As we see , its not allowing because to ssh into a instance need a public ip.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3xswhifbhjre3t1hn88.png)

**_Now lets us deploy a window server/Jump server with in same vpc [enable public ip]_**

- launch instance

- select T2micro

- enable public ip

- name it as jump server

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtdmwusrv3t0ksjtnvky.png)

- select all traffic anywhere and launch .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atqoc8qk7pq4ktyxicer.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvzqcut1a3bpow06dx0d.png)

- launch instance
- view instance
- Check box it [jump server] and try to connect .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/znfvb235xh47xqcyygmf.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mbz1ud35ovwuaf94q95.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/728q5e3rdgtrzwnudzdp.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlkm8ob9nrp3byj5kkzr.png)

- here we successfully connect to our server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qi42m6vmvuk28h5fxe6q.png)

- now we can access to our database within this server only,here this server acts as a bastion host.

- click Window+r
- type mstsc

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jo1q2dlwd8mdnhyzcrzw.png)

- put private ip of database server and connect 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6z1hlxbhrfa9rww0sypq.png)

here we successfully connected to our database.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hr3g829tlymn9bc9727c.png)