KIMS v2 adds no VPC of its own. It lives in the VPC where KIMS's EKS cluster already runs. This page lists the network paths it needs, how to open each one, and how to test it.
#Who does what
| Task | Usually done by | What our engineer needs |
|---|---|---|
| The VPC, subnets, NAT gateway, route tables | KIMS's cloud team (already exist) | The VPC id and the private subnet ids, to put RDS there |
| The RDS security group | KIMS's cloud team, or our engineer if asked | Port 5432 open from the EKS pods and the Jenkins agent |
| Firewall or proxy rules for outbound HTTPS | KIMS's network team | The host list in Outbound HTTPS |
| The S3 gateway endpoint | KIMS's cloud team (often already there) | Nothing, if it exists and its policy allows our buckets |
| Testing each path from inside the cluster | Our engineer | kubectl access to the kims namespace |
#Every network path KIMS v2 uses
| From | To | Port | Why | Opened by |
|---|---|---|---|---|
| CMS, worker, cron and migrate pods | RDS PostgreSQL | TCP 5432 | Every process reads and writes the database | RDS security group |
Jenkins agent (kims-site-build) |
RDS PostgreSQL | TCP 5432 | The site build reads published content and writes its progress | RDS security group |
| CMS, worker, cron pods | S3 (assets bucket) | TCP 443 | Media library: read, write, delete | S3 gateway endpoint, or NAT |
| Pods | AWS STS (sts.<region>.amazonaws.com) |
TCP 443 | IRSA swaps the pod's token for AWS credentials | NAT, or an STS interface endpoint |
| CMS pods | Keycloak | TCP 443 | Sign-in, keys, token refresh | KIMS's routing |
| Keycloak | CMS (https://<CMS_HOST>/api/auth/backchannel-logout) |
TCP 443 | Back-channel logout: ends a session at once | KIMS's routing (see Keycloak client) |
| CMS and worker pods | Jenkins (JENKINS_JOB_URL) |
TCP 443 (or Jenkins's port) | Start a site build after a publish, read its status | KIMS's routing |
| Worker and cron pods | Google APIs | TCP 443 | Translation, Google reviews sync | NAT and firewall (Outbound access) |
| Jenkins agent | npm registry | TCP 443 | npm ci in both jobs |
NAT or proxy |
| Jenkins agent | S3 (both buckets) | TCP 443 | Site build: read media, sync the website | S3 gateway endpoint, or NAT |
| Jenkins agent | CloudFront API and KeyValueStore API | TCP 443 | Invalidation, redirects | NAT (these are global AWS endpoints; there is no VPC endpoint for them) |
| Jenkins agent | ECR | TCP 443 | Push the image | NAT, or ECR interface endpoints |
| Jenkins agent | The EKS cluster's API endpoint | TCP 443 | helm upgrade and kubectl rollout status in the platform job |
The cluster's endpoint access settings (private, or public with the agent's IP allowed) |
| Jenkins agent | KIMS's Git server | TCP 443 or 22 | Checkout in both jobs | KIMS's routing |
| EKS nodes | ECR | TCP 443 | Pull the image | NAT, or ECR interface endpoints plus the S3 gateway endpoint |
| Editors' browsers | S3 (assets bucket) | TCP 443 | Media uploads go straight to S3 with presigned URLs | Nothing in the VPC: this is over the internet |
| Editors' browsers | CMS load balancer | TCP 443 | Using the CMS | The load balancer's security group (EKS ingress) |
| The public | CloudFront | TCP 443 | The website | Nothing in the VPC |
The editors' upload path does not pass through KIMS's VPC. The browser sends the file straight to https://<ASSETS_BUCKET>.s3.<REGION>.amazonaws.com. If editors use a company proxy that blocks S3, uploads fail in the browser while everything else works. See S3 buckets.
#Find the VPC and subnets the cluster uses
Set the names once for this terminal window. Replace every <...>.
export AWS_REGION=ap-south-2
CLUSTER=<EKS_CLUSTER_NAME>
aws eks describe-cluster --name "$CLUSTER" \
--query "cluster.resourcesVpcConfig.{vpc:vpcId,subnets:subnetIds,clusterSg:clusterSecurityGroupId,extraSgs:securityGroupIds}" \
--output jsonexport AWS_REGION=ap-south-2
CLUSTER=<EKS_CLUSTER_NAME>
aws eks describe-cluster --name "$CLUSTER" \
--query "cluster.resourcesVpcConfig.{vpc:vpcId,subnets:subnetIds,clusterSg:clusterSecurityGroupId,extraSgs:securityGroupIds}" \
--output json$env:AWS_REGION = "ap-south-2"
$Cluster = "<EKS_CLUSTER_NAME>"
aws eks describe-cluster --name $Cluster `
--query "cluster.resourcesVpcConfig.{vpc:vpcId,subnets:subnetIds,clusterSg:clusterSecurityGroupId,extraSgs:securityGroupIds}" `
--output jsonYou should see the VPC id (vpc-...), the subnet ids, and the cluster security group (sg-...). Write all three down.
The cluster security group is the one EKS creates (eks-cluster-sg-<cluster>-<number>). Managed node groups attach it to every node, so pods using the node's network carry it. If KIMS uses custom node security groups, Karpenter, or security groups for pods, ask them which group the kims pods leave with: that is the one to allow into RDS.
#Which subnets are private
A private subnet has no route to an internet gateway (igw-...) and usually a 0.0.0.0/0 route to a NAT gateway (nat-...).
VPC=<VPC_ID>
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=$VPC" \
--query "RouteTables[].{table:RouteTableId,subnets:Associations[].SubnetId,defaultRoute:Routes[?DestinationCidrBlock=='0.0.0.0/0'] | [0].[GatewayId,NatGatewayId]}" \
--output jsonVPC=<VPC_ID>
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=$VPC" \
--query "RouteTables[].{table:RouteTableId,subnets:Associations[].SubnetId,defaultRoute:Routes[?DestinationCidrBlock=='0.0.0.0/0'] | [0].[GatewayId,NatGatewayId]}" \
--output json$Vpc = "<VPC_ID>"
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=$Vpc" `
--query "RouteTables[].{table:RouteTableId,subnets:Associations[].SubnetId,defaultRoute:Routes[?DestinationCidrBlock=='0.0.0.0/0'] | [0].[GatewayId,NatGatewayId]}" `
--output jsonSubnets whose default route shows a nat-... id are private with internet egress. igw-... means public. RDS goes in private subnets in at least two Availability Zones (RDS subnet group).
Console: VPC console > Subnets > filter by the VPC > select a subnet > Route table tab.
#The RDS security group
The database's own security group: it allows PostgreSQL in from the pods and the Jenkins agent, and nothing else.
| Setting | Value |
|---|---|
| Name | kims-<ENV>-rds (for example kims-db) |
| VPC | The cluster's VPC |
| Inbound rule 1 | PostgreSQL, TCP 5432, source: the cluster security group (or the pods' group) |
| Inbound rule 2 | PostgreSQL, TCP 5432, source: the Jenkins agent's security group (or its private IP /32 if it is outside AWS or in a peered VPC) |
| Inbound rule 3 (optional) | PostgreSQL, TCP 5432, source: a bastion host's group, for DBA access |
| Outbound | Leave the default (all). RDS does not start connections |
Never open 5432 to 0.0.0.0/0, and keep the database not publicly accessible. Everything that needs the database is inside the VPC.
#Console steps
- EC2 console > left menu Network & Security > Security Groups > Create security group.
- Security group name:
kims-db. Description:KIMS v2 production PostgreSQL. VPC: the cluster's VPC. - Inbound rules > Add rule: Type
PostgreSQL, SourceCustom, then typesg-and choose the cluster security group. Description:EKS pods. - Add rule again: Type
PostgreSQL, Source the Jenkins agent's security group (orCustomwith<AGENT_PRIVATE_IP>/32). Description:Jenkins agent. - Leave Outbound rules as they are. Create security group.
#CLI steps
VPC=<VPC_ID>
CLUSTER_SG=<CLUSTER_SECURITY_GROUP_ID>
AGENT_SG=<JENKINS_AGENT_SECURITY_GROUP_ID>
RDS_SG=$(aws ec2 create-security-group --group-name kims-db \
--description "KIMS v2 production PostgreSQL" --vpc-id "$VPC" \
--query GroupId --output text)
echo "$RDS_SG"
aws ec2 authorize-security-group-ingress --group-id "$RDS_SG" \
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$CLUSTER_SG,Description='EKS pods'}]"
aws ec2 authorize-security-group-ingress --group-id "$RDS_SG" \
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$AGENT_SG,Description='Jenkins agent'}]"VPC=<VPC_ID>
CLUSTER_SG=<CLUSTER_SECURITY_GROUP_ID>
AGENT_SG=<JENKINS_AGENT_SECURITY_GROUP_ID>
RDS_SG=$(aws ec2 create-security-group --group-name kims-db \
--description "KIMS v2 production PostgreSQL" --vpc-id "$VPC" \
--query GroupId --output text)
echo "$RDS_SG"
aws ec2 authorize-security-group-ingress --group-id "$RDS_SG" \
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$CLUSTER_SG,Description='EKS pods'}]"
aws ec2 authorize-security-group-ingress --group-id "$RDS_SG" \
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$AGENT_SG,Description='Jenkins agent'}]"$Vpc = "<VPC_ID>"
$ClusterSg = "<CLUSTER_SECURITY_GROUP_ID>"
$AgentSg = "<JENKINS_AGENT_SECURITY_GROUP_ID>"
$RdsSg = aws ec2 create-security-group --group-name kims-db `
--description "KIMS v2 production PostgreSQL" --vpc-id $Vpc `
--query GroupId --output text
$RdsSg
aws ec2 authorize-security-group-ingress --group-id $RdsSg `
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$ClusterSg,Description='EKS pods'}]"
aws ec2 authorize-security-group-ingress --group-id $RdsSg `
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$AgentSg,Description='Jenkins agent'}]"If the agent is not in AWS (or has no security group you can reference), use a CIDR rule instead:
aws ec2 authorize-security-group-ingress --group-id "$RDS_SG" \
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,IpRanges=[{CidrIp=<AGENT_PRIVATE_IP>/32,Description='Jenkins agent'}]"aws ec2 authorize-security-group-ingress --group-id "$RDS_SG" \
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,IpRanges=[{CidrIp=<AGENT_PRIVATE_IP>/32,Description='Jenkins agent'}]"aws ec2 authorize-security-group-ingress --group-id $RdsSg `
--ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,IpRanges=[{CidrIp=<AGENT_PRIVATE_IP>/32,Description='Jenkins agent'}]"#Check the rules
aws ec2 describe-security-groups --group-ids "$RDS_SG" \
--query "SecurityGroups[0].IpPermissions[].{port:FromPort,groups:UserIdGroupPairs[].GroupId,cidrs:IpRanges[].CidrIp}"aws ec2 describe-security-groups --group-ids "$RDS_SG" \
--query "SecurityGroups[0].IpPermissions[].{port:FromPort,groups:UserIdGroupPairs[].GroupId,cidrs:IpRanges[].CidrIp}"aws ec2 describe-security-groups --group-ids $RdsSg `
--query "SecurityGroups[0].IpPermissions[].{port:FromPort,groups:UserIdGroupPairs[].GroupId,cidrs:IpRanges[].CidrIp}"You should see port 5432 with the cluster group and the agent group (or the agent's /32), and nothing else.
#Outbound HTTPS: the hosts KIMS v2 calls
If KIMS filters egress (a proxy, AWS Network Firewall or a third-party firewall), these must be allowed. The pods have no proxy settings in the Helm chart, so a mandatory HTTP proxy for pods needs a conversation with us before go-live.
| Host | From | For |
|---|---|---|
sts.<REGION>.amazonaws.com |
Pods, agent | IRSA and role credentials |
<ASSETS_BUCKET>.s3.<REGION>.amazonaws.com, s3.<REGION>.amazonaws.com |
Pods, agent | Media (without the S3 gateway endpoint) |
<WEBSITE_BUCKET>.s3.<REGION>.amazonaws.com |
Agent | Website sync |
cloudfront.amazonaws.com |
Agent | Invalidation |
The CloudFront KeyValueStore API (*.cloudfront-kvs.global.api.aws) |
Agent | Writing redirects |
api.ecr.<REGION>.amazonaws.com, <AWS_ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com, and S3 for layers |
Agent, nodes | Push and pull the image |
registry.npmjs.org |
Agent | npm ci |
The Keycloak host in KEYCLOAK_ISSUER |
CMS pods | Sign-in |
The Jenkins host in JENKINS_JOB_URL |
CMS and worker pods | Site builds |
translation.googleapis.com, www.googleapis.com, oauth2.googleapis.com, mybusiness.googleapis.com, mybusinessaccountmanagement.googleapis.com, mybusinessbusinessinformation.googleapis.com (the list in main's runbook, AWS set-up I); details in Outbound access |
CMS, worker and cron pods | Translation, Google sign-in for reviews, reviews sync |
| The EKS API endpoint | Agent | Platform job deploy |
| KIMS's Git host | Agent | Checkout |
#The S3 gateway endpoint
A gateway endpoint for S3 keeps traffic from the pods and the agent to S3 inside AWS instead of through the NAT gateway. It is free and cuts NAT data charges for the media copies the site build makes on every build. Most EKS VPCs already have one.
#Check whether it exists
aws ec2 describe-vpc-endpoints \
--filters "Name=vpc-id,Values=$VPC" "Name=service-name,Values=com.amazonaws.$AWS_REGION.s3" \
--query "VpcEndpoints[].{id:VpcEndpointId,type:VpcEndpointType,state:State,routeTables:RouteTableIds}"aws ec2 describe-vpc-endpoints \
--filters "Name=vpc-id,Values=$VPC" "Name=service-name,Values=com.amazonaws.$AWS_REGION.s3" \
--query "VpcEndpoints[].{id:VpcEndpointId,type:VpcEndpointType,state:State,routeTables:RouteTableIds}"aws ec2 describe-vpc-endpoints `
--filters "Name=vpc-id,Values=$Vpc" "Name=service-name,Values=com.amazonaws.$($env:AWS_REGION).s3" `
--query "VpcEndpoints[].{id:VpcEndpointId,type:VpcEndpointType,state:State,routeTables:RouteTableIds}"You should see one entry with "type": "Gateway", "state": "available", and the private subnets' route tables. An empty list [] means there is none.
If an endpoint exists with a custom endpoint policy, it may only allow named buckets. Ask KIMS to add <ASSETS_BUCKET> and <WEBSITE_BUCKET>, or every S3 call from the pods fails with AccessDenied even though the IAM role is right. Read it with aws ec2 describe-vpc-endpoints --vpc-endpoint-ids <VPCE_ID> --query "VpcEndpoints[0].PolicyDocument".
#Create it (only if KIMS asks you to)
Console: VPC console > Endpoints > Create endpoint > Name kims-s3 > Type AWS services > search s3, choose com.amazonaws.<REGION>.s3 with Type Gateway > VPC the cluster's VPC > tick the private subnets' route tables > Policy Full access > Create endpoint.
aws ec2 create-vpc-endpoint --vpc-id "$VPC" --vpc-endpoint-type Gateway \
--service-name "com.amazonaws.$AWS_REGION.s3" \
--route-table-ids <PRIVATE_ROUTE_TABLE_ID_1> <PRIVATE_ROUTE_TABLE_ID_2>aws ec2 create-vpc-endpoint --vpc-id "$VPC" --vpc-endpoint-type Gateway \
--service-name "com.amazonaws.$AWS_REGION.s3" \
--route-table-ids <PRIVATE_ROUTE_TABLE_ID_1> <PRIVATE_ROUTE_TABLE_ID_2>aws ec2 create-vpc-endpoint --vpc-id $Vpc --vpc-endpoint-type Gateway `
--service-name "com.amazonaws.$($env:AWS_REGION).s3" `
--route-table-ids <PRIVATE_ROUTE_TABLE_ID_1> <PRIVATE_ROUTE_TABLE_ID_2>#A VPC with no NAT gateway
Some locked-down VPCs have no route to the internet at all. KIMS v2 can still run, but needs interface endpoints (each costs per hour per Availability Zone) and still needs a way out for Google, npm and the global CloudFront APIs.
| Endpoint service | Needed for |
|---|---|
com.amazonaws.<REGION>.s3 (gateway) |
S3, and ECR image layers |
com.amazonaws.<REGION>.sts (interface) |
IRSA credentials |
com.amazonaws.<REGION>.ecr.api and com.amazonaws.<REGION>.ecr.dkr (interface) |
Pulling and pushing images |
Without a NAT or proxy, these still cannot work: Google translation and reviews (pods), npm ci (agent), CloudFront invalidation and KeyValueStore redirects (agent). Agree a proxy or a NAT with KIMS before starting.
#Kubernetes network policies
If the kims namespace has a default-deny NetworkPolicy, the pods start and then time out on every outside call. KIMS's policy must allow, from the kims pods: DNS (UDP and TCP 53 to CoreDNS), TCP 5432 to the RDS subnets, TCP 443 anywhere they allow (S3, STS, Keycloak, Jenkins, Google). And into the CMS pods: TCP 3000 from the ingress controller or the load balancer's subnets.
#Test the paths from inside the cluster
The commands use production's namespace kims; for UAT use kims-uat. Run a throwaway pod in the namespace. It is deleted when you exit. It pulls busybox from Amazon's public ECR mirror, so the nodes need outbound access to public.ecr.aws; if they have none, ask KIMS for an internal image with nc.
kubectl -n kims run nettest --rm -it --restart=Never \
--image=public.ecr.aws/docker/library/busybox:1.36 -- shkubectl -n kims run nettest --rm -it --restart=Never \
--image=public.ecr.aws/docker/library/busybox:1.36 -- shkubectl -n kims run nettest --rm -it --restart=Never `
--image=public.ecr.aws/docker/library/busybox:1.36 -- shThen, at the / # prompt inside the pod (the same on every system):
nc -zv -w 5 <RDS_ENDPOINT> 5432
nc -zv -w 5 sts.ap-south-2.amazonaws.com 443
nc -zv -w 5 s3.ap-south-2.amazonaws.com 443
nc -zv -w 5 <KEYCLOAK_HOST> 443
nc -zv -w 5 <JENKINS_HOST> 443
nc -zv -w 5 translation.googleapis.com 443
exitEach should print ... open. timed out means a security group, network policy or firewall drops it; bad address means DNS cannot resolve the name.
main's runbook tests HTTPS paths with curl instead, which also proves TLS works through any proxy. Any HTTP status (even 404) means the path is open; a timeout means it is blocked:
kubectl -n kims run nettest --rm -it --restart=Never --image=curlimages/curl -- \
curl -sS -o /dev/null -w "%{http_code}\n" https://translation.googleapis.comkubectl -n kims run nettest --rm -it --restart=Never --image=curlimages/curl -- \
curl -sS -o /dev/null -w "%{http_code}\n" https://translation.googleapis.comkubectl -n kims run nettest --rm -it --restart=Never --image=curlimages/curl -- `
curl -sS -o /dev/null -w "%{http_code}\n" https://translation.googleapis.comTo test 5432 from the Jenkins agent, on the agent (Linux):
timeout 5 bash -c '</dev/tcp/<RDS_ENDPOINT>/5432' && echo open || echo blockedIf the agent is a Windows machine, in PowerShell:
Test-NetConnection -ComputerName <RDS_ENDPOINT> -Port 5432You should see TcpTestSucceeded : True.
#If it goes wrong
| What you see | Likely cause | What to do |
|---|---|---|
kims-migrate fails with connect ETIMEDOUT ...:5432 |
The RDS security group does not allow the pods' group | Check which group the pods carry; add it as a source on 5432 |
| The site build fails at Export content with a timeout | The agent's group or IP is not in the RDS security group | Add it; test with the agent command above |
getaddrinfo ENOTFOUND <RDS_ENDPOINT> |
Wrong endpoint, or the pods use a DNS that cannot resolve AWS names | Copy the endpoint again from RDS; check CoreDNS |
Media library errors with AccessDenied though the role is right |
A custom S3 endpoint policy does not list the bucket | The S3 gateway endpoint |
Pods log Could not load credentials or time out calling STS |
No route to STS (no NAT, no STS endpoint) | Add the STS interface endpoint or a NAT route |
| Translation or reviews sync fails, everything else works | Egress to Google blocked | Outbound access |
| The site build fails at Install | The agent cannot reach registry.npmjs.org |
NAT or proxy for the agent |
| Uploads in the Media library fail, the rest of the CMS works | The editor's network blocks S3, or CORS is wrong | S3 buckets, CORS |
#Sources
kims-v2/docs/ON-SITE-DEPLOYMENT.mdonmain(AWS set-up D and I: thekims-dbsecurity group and the network checks)kims-v2/docs/CONFIG.md(Keycloak back-channel, S3, Jenkins)kims-v2/deploy/jenkins/README-site.md(agent network needs)kims-v2/scripts/site-build/cloudfront.mjs,kims-v2/scripts/site-build/s3.mjs- https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html
- https://docs.aws.amazon.com/eks/latest/userguide/security-groups-for-pods.html
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html
- https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
- https://docs.aws.amazon.com/vpc/latest/privatelink/aws-services-privatelink-support.html
- https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html
- https://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html