Deploying a Scalable XpoLog Instance on Amazon ECS. NLB with static private IP (ECR)
A complete, step-by-step guide to deploying the entire application manually using the AWS Management Console.
This guide creates the exact same architecture as the final script: a fully private application on Fargate using EFS for storage, with access provided by an internal Network Load Balancer.
Step 1/12: VPC, Subnets, IGW, & Routing
This section builds the foundational network.
Create the VPC:
Go to the VPC service, click "Your VPCs", then "Create VPC".
Select "VPC only".
Name tag:
xpolog-vpcIPv4 CIDR block:
10.0.0.0/16Click "Create VPC".
Navigate to the VPC service in the AWS Console.
In the left menu, click on "Your VPCs".
Select your VPC (it should be named
xpolog-vpc).Click the "Actions" menu at the top right and choose "Edit VPC settings".
Check the boxes for both "Enable DNS hostnames" and "Enable DNS resolution".
Click "Save changes".
Create Subnets:
In the left menu, click "Subnets", then "Create subnet". Create the following four subnets one by one, ensuring you select your
xpolog-vpcfor each.Public Subnet A:
Name:
xpolog-vpc-public-1aAvailability Zone:
eu-north-1aIPv4 CIDR block:
10.0.0.0/20
Public Subnet B:
Name:
xpolog-vpc-public-1bAvailability Zone:
eu-north-1bIPv4 CIDR block:
10.0.16.0/20
Private Subnet A:
Name:
xpolog-vpc-private-1aAvailability Zone:
eu-north-1aIPv4 CIDR block:
10.0.128.0/20
Private Subnet B:
Name:
xpolog-vpc-private-1bAvailability Zone:
eu-north-1bIPv4 CIDR block:
10.0.144.0/20
Create and Attach Internet Gateway (IGW):
In the left menu, click "Internet Gateways", then "Create internet gateway".
Name:
xpolog-igw. Click "Create".Select the new IGW, click the "Actions" menu, and choose "Attach to VPC". Select your
xpolog-vpc.
Configure Routing:
In the left menu, click "Route Tables". You'll see one default route table associated with your VPC.
Create Public Route Table:
Click "Create route table". Name:
xpolog-vpc-rtb-public, selectxpolog-vpc.Select the new public route table. In the "Routes" tab below, click "Edit routes".
Add a route: Destination
0.0.0.0/0, TargetInternet Gateway, and select yourxpolog-igw. Save changes.
Go to the "Subnet associations" tab. Click "Edit subnet associations" and select the two public subnets.
Create Private Route Tables:
Create a new route table. Name:
xpolog-vpc-rtb-private1, selectxpolog-vpc. Associate it with the private subnet A (...-private-1a).Create another route table. Name:
xpolog-vpc-rtb-private2, selectxpolog-vpc. Associate it with the private subnet B (...-private-1b).
Step 2/12: ECR Repository & Image
Here we set up the private container registry.
Navigate to the Elastic Container Registry (ECR) service.
Click "Create repository".
Visibility:
PrivateRepository name:
xpologClick "Create repository".
Select the new repository and click "View push commands".
Follow the four provided commands on your local machine to pull, tag, and push the image.
# Command 1: Authenticate aws ecr get-login-password --region eu-north-1 | docker login ... # Command 2: Pull the public image docker pull 1200km/xplg:7.Release-9787 # Command 3 & 4: Tag and push to your new ECR repository docker tag 1200km/xplg:7.Release-9787 <paste-your-repo-uri-here>:7.Release-9787 docker push <paste-your-repo-uri-here>:7.Release-9787
Of course. Here is the fully corrected and complete guide for Step 3, incorporating all the rules we've discussed.
This version sets up both security groups first and then adds all the necessary inbound rules in a clear, organized way.
## Step 3/12: Security Groups 🛡️
These are the firewalls for our application and storage.
Navigate to the EC2 service in the AWS Console, then go to "Security Groups" in the left-hand menu.
Create the Two Security Groups:
First, click "Create security group" and create the group for the tasks:
Name:
ecs-tasks-xpologDescription:
For xpolog ECS tasksVPC: Select your
xpolog-vpcfrom the dropdown.Click "Create security group".
Next, click "Create security group" again to create the group for the file system:
Name:
efs-xpologDescription:
Allows ECS tasks to access EFSVPC: Select your
xpolog-vpc.Click "Create security group".
Configure the EFS Security Group (
efs-xpolog):Find the
efs-xpologgroup in your list, select it, and click on the "Inbound rules" tab below.Click "Edit inbound rules".
Click "Add rule" and configure it to allow access from your tasks:
Type:
NFSSource:
Custom, and in the search box, find and select yourecs-tasks-xpologsecurity group.
Click "Save rules".
Configure the Tasks Security Group (
ecs-tasks-xpolog):Find the
ecs-tasks-xpologgroup in your list, select it, and go to its "Inbound rules" tab.Click "Edit inbound rules".
You will now add two separate rules for two different purposes.
Rule #1 (For Application Traffic):
Click "Add rule".
Type:
Custom TCPPort Range:
30443Source:
10.0.0.0/16Description (optional):
Allow traffic from NLB on app port
Rule #2 (For ECR Image Pulls):
Click "Add rule" again.
Type:
HTTPSPort Range:
443Source:
Custom. In the search box, find and select theecs-tasks-xpologsecurity group itself.Description (optional):
Allow task to talk to VPC Endpoints
Your final set of inbound rules for
ecs-tasks-xpologshould look like this:Click "Save rules".
Step 4/12: EFS File System & Access Point
This is the shared, persistent storage.
Navigate to the Amazon EFS service.
Click "Create file system".
Name:
xpolog-efs, VPC:xpolog-vpc. Click "Create".Wait for it to become "Available", then click its name.
Go to the "Network" tab and click "Manage". In the table, for both the private subnets, remove the default security group and add the
efs-xpologsecurity group. Save.Go to the "Access points" tab and click "Create access point".
Name:
xpolog-apPOSIX user: User ID
0, Group ID0Root directory creation permissions: Owner User ID
0, Owner Group ID0, Permissions770Click "Create access point".
Step 5/12: CloudWatch Logs Group
This is where all container logs will be sent.
Navigate to the CloudWatch service.
In the left menu, go to Logs -> Log groups.
Click "Create log group".
Log group name:
/ecs/xpolog.After creation, select the new log group. In the "Actions" menu, choose "Edit retention setting" and set it to
30 Days.
Step 6/12: IAM Roles
Permissions for the ECS service to operate.
Navigate to the IAM service -> "Roles".
Create the Execution Role:
Click "Create role".
Trusted entity type:
AWS service, Use case:Elastic Container Service Task. Next.Permissions: Add
AmazonECSTaskExecutionRolePolicy. Next.Role name:
ecsTaskExecutionRole-xpolog. Create.
Create the Task Role:
Create another role with the same settings.
Permissions: Add
AmazonElasticFileSystemClientFullAccess, AmazonElasticFileSystemFullAccess.Role name:
XpologTaskRole-xpolog. Create.
Step 7/12: Target Group & Internal NLB
This step creates the internal entry point for your application, configured for secure traffic.
Navigate to EC2 -> "Target Groups" (under Load Balancing).
Click "Create target group".
Choose a target type: Select
IP addresses.Name:
xpolog-tgProtocol / Port:
TCPand30443.VPC: Select your
xpolog-vpc.Health check protocol:
TCP.Click Next, then "Create target group".
Navigate to EC2 -> "Load Balancers".
Click "Create Load Balancer".
Under Network Load Balancer, click "Create".
Name:
xpolog-nlbScheme:
InternalVPC: Select your
xpolog-vpc.Mappings: Select the two public subnets (e.g.,
xpolog-vpc-public-1aandxpolog-vpc-public-1b).
Configure the Listener and Routing:
In the "Listeners and routing" section, configure the listener:
Protocol:
TLSPort:
30443Default action:
Forward to a target group. Select yourxpolog-tg.Secure listener settings:
Security policy: Leave the default (e.g.,
ELBSecurityPolicy-2016-08).Default SSL/TLS certificate: Choose
From ACMand select the certificate you created for your domain.
Review the summary and click "Create load balancer".
Note: The required inbound rule for port
30443in theecs-tasks-xpologsecurity group was already configured in the revised Step 3..
Step 8/12: VPC Endpoints
Creates private connections to AWS services.
Navigate to VPC -> "Endpoints".
Create Interface Endpoints: Click "Create endpoint" three times. For each, use your
xpolog-vpc, select the two private subnets, and attach theecs-tasks-xpologsecurity group.Service Name:
com.amazonaws.eu-north-1.ecr.apiService Name:
com.amazonaws.eu-north-1.ecr.dkrService Name:
com.amazonaws.eu-north-1.logs
Create Gateway Endpoint: Click "Create endpoint".
Service Name:
com.amazonaws.eu-north-1.s3(This will be TypeGateway).VPC:
xpolog-vpc.Route tables: Select the two private route tables (
...-private1,...-private2).
Step 9/12: ECS Cluster
The logical grouping for our service.
Navigate to ECS -> "Clusters".
Click "Create cluster".
Name:
xpolog-cluster, select AWS Fargate for infrastructure.Click "Create".
Step 10/12: Task Definition 📝
The multi-container blueprint for the application. This is the most detailed step.
Go to ECS -> "Task definitions" -> "Create new task definition".
Task definition family:
xpolog-task