Skip to main content

Running on AWS Fargate (ECS)

AWS Fargate is technology that you can use to run containers with Amazon ECS, without having to manage servers or clusters of EC2 instances. Read What is AWS Fargate for more details.


Fargate can be used with both Amazon ECS and Amazon EKS; this document covers the use of Fargate with ECS. Read our Installation via Docker guide before reading this documentation.

Configure AWS CLI to Interact with ECR

Please read Installing or updating the latest version of the AWS CLI and Configuration and credential file settings to install and configure the AWS CLI.

You should be able to run the aws configure command to set/view your credentials, an example is below:

$ aws configure
AWS Access Key ID [None]: <yourAccessKeyID>
AWS Secret Access Key [None]: <yourSecretKey>
Default region name [None]: <yourAccount-Region> (for instance = us-west-2)
Default output format [None]: <yourOutputFormatPreference> (for instance = json)

Pushing CodeTogether Image to ECR

1. Create Private Repository

From the ECR console, create a private repository. You could use codetogether as the repository name, and leave other settings at their default values.

Observe the URL for the created repository, which should be something like:

2. Build CodeTogether Image

Build your CodeTogether image with the proper settings such as license info, server URL, etc. Please refer to the Docker guide for details.


If you're enabling A/V support, please specify the following environment variables and values: CT_AV_LAN_IP "aws" CT_AV_LOCAL_IP "fargate""

If you mean to use CodeTogether directly from AWS Fargate (i.e., without any front-end Web server), make sure you are adding container's SSL port (1443) to your build Dockerfile as: ENV CT_SERVER_URL https://SERVERFQDN:1443

Build your CodeTogether image:

$ docker build -t "codetogether:local" -f Dockerfile .

3. Log In to the Registry

Use your ECR credentials to log in to your private registry. Ensure you get a Login Succeeded message.

$ aws ecr get-login-password --region <yourAccountRegion> \
| docker login \
--username AWS \
--password-stdin <account-id>.dkr.ecr.<account-region><repository-name>

4. Push CodeTogether Image

Tag your image and push it to ECR.

$ docker tag <image-name>:<image-version> <account-id>.dkr.ecr.<account-region><repository-name>/<image-name>:<image-version>
$ docker push <account-id>.dkr.ecr.<account-region><repository-name>/<image-name>:<image-version>

Create a Fargate Task Definition

From the Amazon ECS console, choose Task Definitions from the navigation pane and create a new task definition.

Select FARGATE as the launch type and use the following values in the task definition:

Task definition namecodetogether-td
Task roleecsTaskExecutionRole
Operating system familyLinux
Task execution roleecsTaskExecutionRole
Task memory2GB
Task CPU1 vCPU

Click Add container and specify the following:

Container name<whatever was used in the docker build command>
TCP port mappings1443,4443
UDP port mappings10000

You can also override any CodeTogether environment values (CT_LICENSEE, CT_AV_ENABLED, etc.), if required.
Once done, click Add to add the container, and then Create to complete creation of the task definition.

Create an ECS Cluster & Service

Choose Clusters from the navigation pane and create a new cluster. Choose the Networking only cluster template, giving it a name like codetogether.

From the Services tab, create a new Service, and use the following values:

Launch typeFargate
Operating system familyLinux
Task definitioncodetogether-td
Platform version1.3.0
Service namecodetogether-svc
Number of tasks1

Go to the next step, and select your cluster VPC and subnets.

Choose to create a new Security Group with the following values:

DescriptionCodeTogether incoming connections
Custom TCP1443
Custom TCP4443 (if A/V enabled)
Custom UDP10000 (if A/V enabled)

Save the security group.

On the next step, Auto Scaling, choose not to adjust the service's desired count.

You can now proceed through to the end of the service creation process to create and then view the service.

Access Running CodeTogether Container

Obtaining the Container's Public IP

Get the public IP for your container from Clusters > codetogether > Task (tab) and clicking on the created task link. From the Details tab, confirm that the Last status is RUNNING. From the Network section, find your container's public IP value.

Accessing the Container

If you are evaluating Codetogether locally (private URL), make sure you are using an /etc/hosts mapping, which maps your container's public IP to the CT_SERVER_URL value you specified.

If you are evaluating Codetogether with a public URL, add a DNS record that maps your container's public IP to the CT_SERVER_URL value you specified. Then, if you are not using a front-end Web server, you can reach your CodeTogether Dashboard at https://<CT_SERVER_URL>:1443/dashboard

Check Container Log

In the same Details tab, find the Containers section. Expand the codetogether container and click the View logs in CloudWatch link. In the newly opened tab/window, you will see the CodeTogether container's activity.

2021-12-15T14:53:06.168-06:00    Setting customized time zone >> America/Chicago
2021-12-15T14:53:06.171-06:00 2021-12-15 14:53 [INFO] CodeTogether v5.0.1-01149
2021-12-15T14:53:06.171-06:00 2021-12-15 14:53 [INFO] Use of this software is governed under the CodeTogether End User License Agreement.
2021-12-15T14:53:06.171-06:00 2021-12-15 14:53 [INFO] Disabling A/V communication channels in CodeTogether sessions.
2021-12-15T14:53:06.179-06:00 2021-12-15 14:53 [INFO] Starting CodeTogether Web server ...