AWS Lightsail Instances
This guide outlines the steps to launch a Docker container on an AWS Lightsail instance, pulling the image from a private Amazon Elastic Container Registry (ECR) repository. This guide assumes a RHEL-based (e.g., Amazon Linux, Fedora, CentOS) Lightsail instance that uses dnf or yum.
Prerequisites​
- An active AWS account.
- An AWS Lightsail instance (RHEL-based Linux distribution).
- Your ECR repository URI and image tag.
- AWS Access Key ID and Secret Access Key provided by Eclypses with ECR Read Permissions.
Video Guide​
Step 1: Connect to Lightsail Instance and Configure AWS CLI​
Connect to your Lightsail instance and configure the AWS CLI using the credentials provided by Eclypses.
-
Connect to Lightsail Instance:
- Go to your Lightsail console.
- Click on your instance name, then click the Connect button to open an SSH session in your browser, or use your preferred SSH client.
-
Install AWS CLI (if not already installed):
sudo dnf install awscli -y -
Configure AWS CLI:
aws configureYou will be prompted to enter the following:
AWS Access Key ID: Paste the Access Key ID provided by Eclypses.AWS Secret Access Key: Paste the Secret Access Key provided by Eclypses.Default region name: Enterus-east-1(or your ECR repository's region).Default output format: You can leave this blank or enterjson.
Step 2: Install Docker​
Check if Docker is installed. If not, install and start the Docker service.
-
Check Docker Installation:
docker -v -
Install Docker (if not installed): If the previous command indicates Docker is not installed, run:
sudo dnf update -ysudo dnf install docker -ysudo systemctl start dockersudo systemctl enable docker
Note: Depending on your OS and Package Manager, the commands may be different. The goal is to install Docker on your system.
Step 3: Authenticate Docker with ECR and Pull the Image​
Authenticate Docker with ECR and pull your private image. If you encounter permission errors, add your user to the docker group.
-
Log in to ECR: This command gets a temporary authorization token from ECR and pipes it to
docker login.aws ecr get-login-password \--region us-east-1 \| docker login --username AWS \--password-stdin 321186633847.dkr.ecr.us-east-1.amazonaws.comReplace
321186633847.dkr.ecr.us-east-1.amazonaws.comwith your ECR repository's URI. You should seeLogin Succeeded. -
Grant Docker Permissions to your User (if needed): If you encounter
permission deniederrors when trying to run Docker commands, your user needs to be added to thedockergroup.sudo usermod -aG docker $USERAfter running this, you must log out and log back in to your Lightsail instance for the group changes to take effect.
exitThen reconnect via SSH.
-
Pull the Docker Image:
docker pull 321186633847.dkr.ecr.us-east-1.amazonaws.com/customer/on-prem/mte-relay-server:5.0.0-beta.1Replace the repository URI and tag with your specific image details.
Step 4: Run the Docker Container​
Run your Docker container using the pulled image, mapping port 80 on the host. Remember to properly quote environment variables containing special characters like JSON.
Use the DOMAIN_MAP Builder tool to configure your DOMAIN_MAP value visually and copy a ready-to-use JSON string.
docker run \
-p 80:8080 \
-e AWS_REGION=us-west-2 \
-e 'DOMAIN_MAP={ "*": { "upstream": "https://eclypses.com", "cors_origins": [ "*" ], "client_id_secret": "bFG9pHKswzVKFkhSVrpMHDzKTrqUptc6" } }' \
--rm \
321186633847.dkr.ecr.us-east-1.amazonaws.com/customer/on-prem/mte-relay-server:5.0.0-beta.1
Finally, check that your server is accessible by using a web browser to visit the following URL
http://__IP_ADDRESS__/api/mte-echo
Step 5: Next Steps​
- Consult the On-Prem server configuration guide here.
- Consult the On-Prem server deployment guide here to learn about using Docker Swarm or Kubernetes to deploy your container.