Across accounts and regions deployment to EKS with Amazon CodeCatalyst
This blog provide the practices of of VPC connection, Environment, Account Association, Workflow action for CodeCatalyst to deploy applications to EKS across accounts and regions.
The CodeCatalyst workflow currently provides built-in Kubernetes actions to easily deploy applications to Amazon EKS. The EKS API server offers both public and private endpoints for external services. For security reasons, application deployments in EKS are typically done through the private endpoint of the API server. Additionally, in enterprise environments, business teams often have their own accounts and network address allocations on Amazon Web Services based on compliance and security considerations, meaning that each team's EKS cluster is deployed in different accounts and VPCs. Furthermore, the CodeCatalyst service is currently only available in the US West (Oregon) and EU West (Ireland) regions, and the Amazon Web Services console and CodeCatalyst console are independent of each other, each having its own account system. Interactions between CodeCatalyst and Amazon Web Services resources require public internet access. If you need to use CodeCatalyst to deploy applications through the private endpoint of EKS across multiple Amazon Web Services accounts and regions to meet business expansion and security compliance requirements, can CodeCatalyst meet these needs? The answer is yes. In November 2023, CodeCatalyst announced support for Amazon Virtual Private Cloud (Amazon VPC), allowing you to create VPC connections between CodeCatalyst and your VPC. Amazon CodeCatalyst can utilize all the features of VPC, and you can use VPC peering connections (or transit gateways) to allow CodeCatalyst to deploy applications to EKS in another region. Additionally, the environment management feature of CodeCatalyst can associate with multiple Amazon Web Services accounts, enabling cross-account resource access. This blog post will guide you on how to use and configure CodeCatalyst for cross-account and cross-region deployment of applications to EKS clusters.

- You have activated CodeCatalyst and created an Amazon CodeCatalyst space (us-west-2) and project.
- The space is associated with the workflow account (8995xxxxxxxx).
- EKS is ready in the target account (4729xxxxxxxx) and region ap-northeast-1.
- The EKS cluster API server is configured to allow access via the private endpoint.
- The AWS CLI is configured with the necessary permissions.
- For Number of public subnets, make sure that you have at least one public subnet in any Availability Zone.
- For Number of private subnets, make sure that you have one private subnet in each available Availability Zone in a region.
- Make sure your VPC has access to the internet.
- CodeCatalyst does not support assigning a public IP address to the network interfaces that it creates. One way to do this, is to add a NAT device to use CodeCatalyst with your VPC.


- AWS account connection - Select the target account "test2" that we created in the previous steps, where EKS is located.
- Default IAM role - Select the role used to deploy applications to EKS.
- VPC connection - Select the "codecatalyst-vpc-con" that we created earlier.


Let’s create configurations file in the repo:
- Kubernetes/cd.conf
- Kubernetes/deploy.yaml

Edit and update the workflow content as below:

Modify the configuration required for the DeployAppToEKS process:
- Environment - Select the environment "eks-dev-env" that we created in the previous steps. Once selected, the account, role, and VPC connection information will be automatically retrieved and displayed.
- Region - The region of the target account; here we choose Asia Pacific (Tokyo), ap-northeast-1.


- Add the workflow account and target account to CodeCatalyst.
- Create a VPC connection between CodeCatalyst and the workflow VPC.
- Create a VPC peering connection between the workflow VPC and the target VPC.
- Create an environment and bind it to the target account and workflow VPC for deployment.
- Run the workflow actions, which will assume the CodeCatalyst workflow role to perform the deployment.

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.