Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michalswi/azure-vm-behind-lb
VM behind Azure LB
https://github.com/michalswi/azure-vm-behind-lb
azure-loadbalancer azure-virtual-machine azure-vm honeypot terraform
Last synced: 19 days ago
JSON representation
VM behind Azure LB
- Host: GitHub
- URL: https://github.com/michalswi/azure-vm-behind-lb
- Owner: michalswi
- Created: 2022-04-01T06:43:09.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-07T12:14:57.000Z (about 1 year ago)
- Last Synced: 2024-11-13T22:13:19.640Z (3 months ago)
- Topics: azure-loadbalancer, azure-virtual-machine, azure-vm, honeypot, terraform
- Language: HCL
- Homepage: https://michalswi.medium.com/simple-app-to-fetch-ip-address-be8907eca1c6
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![](https://img.shields.io/github/issues/michalswi/azure-vm-behind-lb)
![](https://img.shields.io/github/forks/michalswi/azure-vm-behind-lb)
![](https://img.shields.io/github/stars/michalswi/azure-vm-behind-lb)
![](https://img.shields.io/github/last-commit/michalswi/azure-vm-behind-lb)Adjust values [here](./variables.tf) if needed for:
- **VM size**, by default it's `Standard_B1s`
- **Azure region**, by default it's `West Europe`
- **Public IP**, your public IP address allowed to ssh to VM**whatismyip** GitHub [link](https://github.com/michalswi/whatismyip).
```
# Log in to Azureaz login
# Generate ssh key
ssh-keygen -t rsa -b 2048 -N "" -f ./demo -C "demo@demon"
# Deploy Azure LB and VM
PUB_IP=
terraform init
terraform apply -var public_ip=$PUB_IP# Verify ports
$ sudo nmap -v -Pn -p 22,80,443
(...)
PORT STATE SERVICE
22/tcp open ssh
80/tcp closed http
443/tcp closed https# Register your public IP
$ NAME=demo-$RANDOM
$ ./fqdn.sh $NAME
<$NAME>.westeurope.cloudapp.azure.com# Configure docker on VM
$ ssh -i -l demo
demo@demon:~$ sudo usermod -aG docker $(whoami)
demo@demon:~$ exit // log out from VM and log in$ ssh -i -l demo
demo@demon:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES# Run whatismyip app
demo@demon:~$ git clone https://github.com/michalswi/whatismyip.git
demo@demon:~$ cd whatismyipdemo@demon:~$ SERVER_PORT=80 make docker-run-bridge
# Test (only HTTP no HTTPS)
$ sudo nmap -v -Pn -p 22,80
(...)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed httpscurl $NAME.westeurope.cloudapp.azure.com
curl $NAME.westeurope.cloudapp.azure.com/ipOR
firefox $NAME.westeurope.cloudapp.azure.com
firefox $NAME.westeurope.cloudapp.azure.com/ip# Destroy Azure resources
terraform destroy -auto-approve -var public_ip=$PUB_IP
./clear.sh
```