Skip to main content

Creating a Cluster via the AWS CLI

In this guide we will create an HA Kubernetes cluster with 3 worker nodes. We assume an existing VPC, and some familiarity with AWS. If you need more information on AWS specifics, please see the official AWS documentation.

Set the needed info

Change to your desired region:

Create the Subnet

Use a CIDR block that is present on the VPC specified above.
Note the subnet ID that was returned, and assign it to a variable for ease of later use:

Official AMI Images

Official AMI image ID can be found in the cloud-images.json file attached to the Talos release. Replace amd64 in the line above with the desired architecture. Note the AMI id that is returned is assigned to an environment variable: it will be used later when booting instances. If using the official AMIs, you can skip to Creating the Security group

Create your own AMIs

The use of the official Talos AMIs are recommended, but if you wish to build your own AMIs, follow the procedure below.

Create the S3 Bucket

Create the vmimport Role

In order to create an AMI, ensure that the vmimport role exists as described in the official AWS documentation. Note that the role should be associated with the S3 bucket we created above.

Create the Image Snapshot

First, download the AWS image from a Talos release: Copy the RAW disk to S3 and import it as a snapshot:
Save the SnapshotId, as we will need it once the import is done. To check on the status of the import, run:
Once the SnapshotTaskDetail.Status indicates completed, we can register the image.

Register the Image

We now have an AMI we can use to create our cluster. Save the AMI ID, as we will need it when we create EC2 instances.

Create a Security Group

Using the security group from above, allow all internal traffic within the same security group:
and expose the Talos and Kubernetes APIs:
If you are using KubeSpan and will be adding workers outside of AWS, you need to allow inbound UDP for the Wireguard port:

Create a Load Balancer

Take note of the DNS name and ARN. We will need these soon.
Also note the TargetGroupArn that is returned.

Create the Machine Configuration Files

Using the DNS name of the loadbalancer created earlier, generate the base configuration files for the Talos machines.
Note that the port used here is the externally accessible port configured on the load balancer - 443 - not the internal port of 6443:
Note that the generated configs are too long for AWS userdata field if the --with-examples and --with-docs flags are not passed.
At this point, you can modify the generated configs to your liking. Optionally, you can specify --config-patch with RFC6902 jsonpatch which will be applied during the config generation.

Validate the Configuration Files

Create the EC2 Instances

change the instance type if desired. Note: There is a known issue that prevents Talos from running on T2 instance types. Please use T3 if you need burstable instance types.

Create the Control Plane Nodes

Make a note of the resulting PrivateIpAddress from the controlplane nodes for later use.

Create the Worker Nodes

Configure the Load Balancer

Now, using the load balancer target group’s ARN, and the PrivateIpAddress from the controlplane instances that you created :
Using the ARNs of the load balancer and target group from previous steps, create the listener:

Bootstrap Etcd

Set the endpoints (the control plane node to which talosctl commands are sent) and nodes (the nodes that the command operates on):
Bootstrap etcd:

Retrieve the kubeconfig

At this point we can retrieve the admin kubeconfig by running:
The different control plane nodes should send/receive traffic via the load balancer, notice that one of the control plane has intiated the etcd cluster, and the others should join. You can now watch as your cluster bootstraps, by using
You can also watch the performance of a node, via:
And use standard kubectl commands.