It is a simple web practice combined with AWS EC2, FastAPI and Geo-map.
In this repo, you can show geo-map generated from folium on your own website and share the links to others.
- Have your own AWS account.
- Start up an EC2 with Amazon Linux 2 AMI and ensure connection.
- Ref:
Tutorial: Get started with Amazon EC2 Linux instances
Work with security groups
When connecting the EC2, you would see the screen below:

First of all, we update yum.
sudo yum updateInstall Docker and start up.
sudo amazon-linux-extras install docker
sudo usermod -a -G docker ec2-user
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status dockerInstall Docker-Compose and link it to sudo.
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-composeNow, install git and then download this github repo.
sudo yum install git
git clone https://github.com/GallonShih/fastapi-geomap.gitEnter the fastapi-geomap folder and build the docker.
cd fastapi-geomap
sudo docker-compose up -d --buildAt the first time, you must wait for few seconds.

So far, we start up a local web server on AWS EC2. However, we want to let other people can visit this website by specific URL. Thus, we must to do some other settings.
Install Nginx and start up.
sudo amazon-linux-extras install nginx1 -y
sudo systemctl enable nginx
sudo systemctl start nginxCreate nginx conf file.
sudo vi /etc/nginx/conf.d/fastapi.confThe demo setting conf file just likes below:
server {
listen 80;
server_name {your own aws ec2 IP};
location / {
proxy_pass http://127.0.0.1:8008;
}
}
And reload the nginx.
sudo nginx -s reloadNow, you can use your browser to get http://{your own aws ec2 IP}/api/v1/geomap/


