Introduction
In this article, I will use Former2 to create AWS CloudFormation templates for existing AWS resources. Former2 is available as a web app and can be used via a browser, but it requires AWS credentials to access the environment. I’m not comfortable with storing credentials on an external site even with read-only permissions, so this time I’d like to host Former2 on AWS Cloud9.
Intended Audience
This article is intended for people who
- want to create AWS CloudFormation templates from their existing AWS resources.
- want not to store their AWS credentials on an external site.
Procedure
Install Docker Compose
In the following steps, we will use Docker Compose, so install Docker Compose while referencing to the official documentation. Docker Compose v2 seems to be slightly different from that of v1 in installation method. This time I will install v2. Execute the following command.
$ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
$ mkdir -p $DOCKER_CONFIG/cli-plugins
$ curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
Once the download is complete, grant execute permission to the binary.
$ chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
Confirm that the installation is complete.
$ docker compose version
Docker Compose version v2.2.3
Clone Repository
the repository of Former2 is public, so clone it.
$ git clone https://github.com/iann0036/former2.git
Edit Port Forwarding Settings
When using AWS Cloud9, the ports that can be used are limited to 8080, 8081, and 8082. (Previewing running applications in the AWS Cloud9 Integrated Development Environment (IDE))Therefore, edit docker-compose.yml, which is located at the top level of the cloned folder, and change the port forwarding settings. See the official documentation (Compose file version 3 reference | Docker Documentation) for more information on configuring docker-compose.yml.
version: '3'
services:
former2:
image: nginx:1.17.8-alpine
ports:
- "127.0.0.1:8080:80"
volumes:
- .:/usr/share/nginx/html
Start Former2
Start Former2.
$ cd former2
$ docker compose up -d
[+] Running 2/2
⠿ Network former2_default Created
⠿ Container former2-former2-1 Started
From the “Preview Running Application”, I can confirm that Former2 is running.
Conclusion
This time, I hosted Former2 on AWS Cloud9, because hosting on AWS Cloud9 allows you to use Former2 without storing your AWS credentials on an external site. So, if you are security conscious, I think this is a good way to go. I hope this article will be helpful to someone.
コメント