...
Currently, the way Docker containers are deployed on AWS is basically having them run on an EC2 instance (with public IP 3.232.82.82). EC2 instances. This means that each service occupies a unique port on the machine. Below is a list of running services and the ports they are using.
| Service | Port |
|---|---|
| Backend offline | 5000 |
Procedure
| online | 5001 |
Test and production environments are deployed separately on the EC2 instances below.
| Function | IP address | Key pair file |
|---|---|---|
| Test | 3.232.82.82 | DIAPER-test-key.pem |
| Production | 35.168.248.57 | DIAPER-production-key.pem |
Procedure
The procedure for deploying is the same for both EC2 instances. First, download the key pair file corresponding to the instance and First, download the key pair file DIAPER-test-key.pem and run
| Code Block |
|---|
chmod 400 /path/to/DIAPER-test*-key.pem |
Then, ssh into the EC2 instance using
| Code Block |
|---|
ssh -i /path/to/DIAPER-test*-key.pem ec2-user@3.232.82.82user@<ip address> |
Pull your Docker image and other relevant file from GitHub. Once pulled, navigate to your project folder and run the Docker as you would do locally (but make sure to run them with sudo). To keep your service from blocking the console, you should run your Docker in detached mode . Alternatively, you can first enter ctrl-z to suspend the service and then run the following commands
| Code Block |
|---|
bg
disown -h |
Doing this also makes your service run in backgroundusing the -d option.
Now you can log out and the service will continue running on the EC2 instance.