Running Flatcar Container Linux on EC2¶
The current AMIs for all Flatcar Container Linux channels and EC2 regions are listed below and updated frequently. Using CloudFormation is the easiest way to launch a cluster, but it is also possible to follow the manual steps at the end of the article. Questions can be directed to the Flatcar Container Linux IRC channel or user mailing list.
Choosing a channel¶
Flatcar Container Linux is designed to be updated automatically with different schedules per channel. You can disable this feature, although we don't recommend it. Read the release notes for specific features and bug fixes.
The Alpha channel closely tracks master and is released frequently. The newest versions of system libraries and utilities will be available for testing. The current version is Flatcar Container Linux 2345.0.0.
View as json feedEC2 Region | AMI Type | AMI ID | CloudFormation |
---|---|---|---|
ap-northeast-1 | PV | ami-042882fb8720c9ef3 | ![]() |
HVM | ami-0776caec522fae21d | ![]() |
|
ap-northeast-2 | PV | ![]() |
|
HVM | ami-0318eb49b2abd920c | ![]() |
|
ap-south-1 | PV | ![]() |
|
HVM | ami-023814c46ec4f5362 | ![]() |
|
ap-southeast-1 | PV | ami-06f520e398bf3b19c | ![]() |
HVM | ami-028d2972600696ef2 | ![]() |
|
ap-southeast-2 | PV | ami-0a13f70d0d2bfd454 | ![]() |
HVM | ami-08f522e029a6d0067 | ![]() |
|
ca-central-1 | PV | ![]() |
|
HVM | ami-00b7030cbb20dd37d | ![]() |
|
eu-central-1 | PV | ami-0f498ecd5a9fd4377 | ![]() |
HVM | ami-062ac79c71b297e6e | ![]() |
|
eu-west-1 | PV | ami-07efb846d9ef2f4c8 | ![]() |
HVM | ami-0e4e59e8798cd2f13 | ![]() |
|
eu-west-2 | PV | ![]() |
|
HVM | ami-07112805d2291fd35 | ![]() |
|
eu-west-3 | PV | ![]() |
|
HVM | ami-014a6cf7d29622f5e | ![]() |
|
sa-east-1 | PV | ami-02ddd330ca37ea3f2 | ![]() |
HVM | ami-0b8d66e51967375c6 | ![]() |
|
us-east-1 | PV | ami-0be7abb81ace3b264 | ![]() |
HVM | ami-02f56e4181b59a06b | ![]() |
|
us-east-2 | PV | ![]() |
|
HVM | ami-014697306d4905b08 | ![]() |
|
us-west-1 | PV | ami-0daec4967e71b126c | ![]() |
HVM | ami-0654d80d88a8941e3 | ![]() |
|
us-west-2 | PV | ami-0b9a6d176b92f60b2 | ![]() |
HVM | ami-0a9fb7d18e76b88a2 | ![]() |
The Beta channel consists of promoted Alpha releases. The current version is Flatcar Container Linux 2331.1.0.
View as json feedEC2 Region | AMI Type | AMI ID | CloudFormation |
---|---|---|---|
ap-northeast-1 | PV | ami-08374fa17b77c40fd | ![]() |
HVM | ami-08bc83cb350f05feb | ![]() |
|
ap-northeast-2 | PV | ![]() |
|
HVM | ami-0c7eef0a7943260f6 | ![]() |
|
ap-south-1 | PV | ![]() |
|
HVM | ami-08b47310153435c92 | ![]() |
|
ap-southeast-1 | PV | ami-0cc0c17a752cdf28f | ![]() |
HVM | ami-0c91a70d55dedeafb | ![]() |
|
ap-southeast-2 | PV | ami-055bb52411d6d0afa | ![]() |
HVM | ami-0adc0a78fc981d8a7 | ![]() |
|
ca-central-1 | PV | ![]() |
|
HVM | ami-01b6c8e1d0b0edf9c | ![]() |
|
eu-central-1 | PV | ami-0f2730c82a36a0962 | ![]() |
HVM | ami-0d819519b66870039 | ![]() |
|
eu-west-1 | PV | ami-05492f5e3e3072fe1 | ![]() |
HVM | ami-04feebea065403677 | ![]() |
|
eu-west-2 | PV | ![]() |
|
HVM | ami-01e0bf07ee4c2649e | ![]() |
|
eu-west-3 | PV | ![]() |
|
HVM | ami-0789f1ea6e69d4dc2 | ![]() |
|
sa-east-1 | PV | ami-0f2e0b00cf65f6d63 | ![]() |
HVM | ami-00349b535e26735e4 | ![]() |
|
us-east-1 | PV | ami-08ce1119d91c9e989 | ![]() |
HVM | ami-0cf3f3c504f8a255b | ![]() |
|
us-east-2 | PV | ![]() |
|
HVM | ami-0be63aa0713cefeb9 | ![]() |
|
us-west-1 | PV | ami-0e67fcf1b53722894 | ![]() |
HVM | ami-07c849dfbbefb5c99 | ![]() |
|
us-west-2 | PV | ami-0e9060181b68c8357 | ![]() |
HVM | ami-03c934ec7b9046a08 | ![]() |
The Edge channel includes bleeding-edge features with the newest versions of the Linux kernel, systemd and other core packages. Can be highly unstable. The current version is Flatcar Container Linux 2303.99.1.
EC2 Region | AMI Type | AMI ID | CloudFormation |
---|---|---|---|
ap-northeast-1 | PV | ami-0a225b44263c9a79d | ![]() |
HVM | ami-0cab8597f9076b50e | ![]() |
|
ap-northeast-2 | PV | ![]() |
|
HVM | ami-07e87cf6d11183294 | ![]() |
|
ap-south-1 | PV | ![]() |
|
HVM | ami-01a81541e8d1cf8da | ![]() |
|
ap-southeast-1 | PV | ami-0cce6a6b15e7decd0 | ![]() |
HVM | ami-0206bdb5257e1845e | ![]() |
|
ap-southeast-2 | PV | ami-0607ec3bb00e2bde0 | ![]() |
HVM | ami-09b27c734c32a6db1 | ![]() |
|
ca-central-1 | PV | ![]() |
|
HVM | ami-0c205201523b0606d | ![]() |
|
eu-central-1 | PV | ami-036f138b8072de257 | ![]() |
HVM | ami-0f1c15a49ae6d8fe3 | ![]() |
|
eu-west-1 | PV | ami-006d8fdd653d584db | ![]() |
HVM | ami-0f9e34273bb0afda7 | ![]() |
|
eu-west-2 | PV | ![]() |
|
HVM | ami-05e31ec2838a93abd | ![]() |
|
eu-west-3 | PV | ![]() |
|
HVM | ami-05ce072c91dcd6102 | ![]() |
|
sa-east-1 | PV | ami-00f91bb98d45774b8 | ![]() |
HVM | ami-02529617073f95be0 | ![]() |
|
us-east-1 | PV | ami-06e8626855b5f0d11 | ![]() |
HVM | ami-0554144a991ee2596 | ![]() |
|
us-east-2 | PV | ![]() |
|
HVM | ami-0f30f83383480619e | ![]() |
|
us-west-1 | PV | ami-014b15dddf268702f | ![]() |
HVM | ami-08d8586877a385fe2 | ![]() |
|
us-west-2 | PV | ami-0b66a05acb08a27e5 | ![]() |
HVM | ami-0022415280a6c08b6 | ![]() |
The Stable channel should be used by production clusters. Versions of Flatcar Container Linux are battle-tested within the Beta and Alpha channels before being promoted. The current version is Flatcar Container Linux 2303.3.0.
View as json feedEC2 Region | AMI Type | AMI ID | CloudFormation |
---|---|---|---|
ap-northeast-1 | PV | ami-04780edd546cae9cd | ![]() |
HVM | ami-06f0f6d1803cebc00 | ![]() |
|
ap-northeast-2 | PV | ![]() |
|
HVM | ami-04ca85723ec15146f | ![]() |
|
ap-south-1 | PV | ![]() |
|
HVM | ami-0fde66e0672da3c77 | ![]() |
|
ap-southeast-1 | PV | ami-0e78a19e3f3365321 | ![]() |
HVM | ami-080daf9ba3a611f10 | ![]() |
|
ap-southeast-2 | PV | ami-0024f469584b6c1c6 | ![]() |
HVM | ami-0814264bec66c0993 | ![]() |
|
ca-central-1 | PV | ![]() |
|
HVM | ami-03cc5c255029bfab3 | ![]() |
|
eu-central-1 | PV | ami-0859b89207e60d132 | ![]() |
HVM | ami-0d5a49659dec77965 | ![]() |
|
eu-west-1 | PV | ami-0019c44517ab9a7c5 | ![]() |
HVM | ami-0f86251689411749d | ![]() |
|
eu-west-2 | PV | ![]() |
|
HVM | ami-09071fd99e4d52356 | ![]() |
|
eu-west-3 | PV | ![]() |
|
HVM | ami-0331176a89635da0c | ![]() |
|
sa-east-1 | PV | ami-007f393679d20744e | ![]() |
HVM | ami-061e80c52825921a4 | ![]() |
|
us-east-1 | PV | ami-0cd41626c2d7e7fef | ![]() |
HVM | ami-0bec30eaca6325366 | ![]() |
|
us-east-2 | PV | ![]() |
|
HVM | ami-05596993ab3e27a8f | ![]() |
|
us-west-1 | PV | ami-0dead7c23e8ca29fc | ![]() |
HVM | ami-01a92755bd145f1f0 | ![]() |
|
us-west-2 | PV | ami-0f42a6681c43973eb | ![]() |
HVM | ami-0448d339360a2373d | ![]() |
CloudFormation will launch a cluster of Flatcar Container Linux machines with a security and autoscaling group.
Container Linux Configs¶
Flatcar Container Linux allows you to configure machine parameters, configure networking, launch systemd units on startup, and more via Container Linux Configs. These configs are then transpiled into Ignition configs and given to booting machines. Head over to the docs to learn about the supported features.
You can provide a raw Ignition config to Flatcar Container Linux via the Amazon web console or via the EC2 API.
As an example, this Container Linux Config will configure and start etcd:
etcd:
# All options get passed as command line flags to etcd.
# Any information inside curly braces comes from the machine at boot time.
# multi_region and multi_cloud deployments need to use {PUBLIC_IPV4}
advertise_client_urls: "http://{PRIVATE_IPV4}:2379"
initial_advertise_peer_urls: "http://{PRIVATE_IPV4}:2380"
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
listen_client_urls: "http://0.0.0.0:2379"
listen_peer_urls: "http://{PRIVATE_IPV4}:2380"
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
discovery: "https://discovery.etcd.io/<token>"
Instance storage¶
Ephemeral disks and additional EBS volumes attached to instances can be mounted with a .mount
unit. Amazon's block storage devices are attached differently depending on the instance type. Here's the Container Linux Config to format and mount the first ephemeral disk, xvdb
, on most instance types:
storage:
filesystems:
- mount:
device: /dev/xvdb
format: ext4
wipe_filesystem: true
systemd:
units:
- name: media-ephemeral.mount
enable: true
contents: |
[Mount]
What=/dev/xvdb
Where=/media/ephemeral
Type=ext4
[Install]
RequiredBy=local-fs.target
For more information about mounting storage, Amazon's own documentation is the best source. You can also read about mounting storage on Flatcar Container Linux.
Adding more machines¶
To add more instances to the cluster, just launch more with the same Container Linux Config, the appropriate security group and the AMI for that region. New instances will join the cluster regardless of region if the security groups are configured correctly.
SSH to your instances¶
Flatcar Container Linux is set up to be a little more secure than other cloud images. By default, it uses the core
user instead of root
and doesn't use a password for authentication. You'll need to add an SSH key(s) via the AWS console or add keys/passwords via your Container Linux Config in order to log in.
To connect to an instance after it's created, run:
ssh core@<ip address>
Multiple clusters¶
If you would like to create multiple clusters you will need to change the "Stack Name". You can find the direct template file on S3.
Manual setup¶
TL;DR: launch three instances of ami-0be7abb81ace3b264 in us-east-1 with a security group that has open port 22, 2379, 2380, 4001, and 7001 and the same "User Data" of each host. SSH uses the core
user and you have etcd and Docker to play with.
Creating the security group¶
You need open port 2379, 2380, 7001 and 4001 between servers in the etcd
cluster. Step by step instructions below.
This step is only needed once
First we need to create a security group to allow Flatcar Container Linux instances to communicate with one another.
- Go to the security group page in the EC2 console.
- Click "Create Security Group"
- Name: flatcar-testing
- Description: Flatcar Container Linux instances
- VPC: No VPC
- Click: "Yes, Create"
- In the details of the security group, click the
Inbound
tab - First, create a security group rule for SSH
- Create a new rule:
SSH
- Source: 0.0.0.0/0
- Click: "Add Rule"
- Create a new rule:
- Add two security group rules for etcd communication
- Create a new rule:
Custom TCP rule
- Port range: 2379
- Source: type "flatcar-testing" until your security group auto-completes. Should be something like "sg-8d4feabc"
- Click: "Add Rule"
- Repeat this process for port range 2380, 4001 and 7001 as well
- Create a new rule:
- Click "Apply Rule Changes"
Launching a test cluster¶
We will be launching three instances, with a few parameters in the User Data, and selecting our security group.
- Open the quick launch wizard to boot ami-0be7abb81ace3b264.
-
On the second page of the wizard, launch 3 servers to test our clustering
- Number of instances: 3
- Click "Continue"
- Next, we need to specify a discovery URL, which contains a unique token that allows us to find other hosts in our cluster. If you're launching your first machine, generate one at https://discovery.etcd.io/new?size=3, configure the `?size=` to your initial cluster size and add it to the metadata. You should re-use this key for each machine in the cluster.
-
Use ct to convert the following configuration into an Ignition config, and back in the EC2 dashboard, paste it into the "User Data" field.
wzxhzdk:3
- Paste configuration into "User Data"
- "Continue"
-
Storage Configuration
- "Continue"
-
Tags
- "Continue"
-
Create Key Pair
- Choose a key of your choice, it will be added in addition to the one in the gist.
- "Continue"
-
Choose one or more of your existing Security Groups
- "flatcar-testing" as above.
- "Continue"
- Launch!
We will be launching three instances, with a few parameters in the User Data, and selecting our security group.
- Open the quick launch wizard to boot ami-08ce1119d91c9e989.
-
On the second page of the wizard, launch 3 servers to test our clustering
- Number of instances: 3
- Click "Continue"
- Next, we need to specify a discovery URL, which contains a unique token that allows us to find other hosts in our cluster. If you're launching your first machine, generate one at https://discovery.etcd.io/new?size=3, configure the `?size=` to your initial cluster size and add it to the metadata. You should re-use this key for each machine in the cluster.
-
Use ct to convert the following configuration into an Ignition config, and back in the EC2 dashboard, paste it into the "User Data" field.
wzxhzdk:4
- Paste configuration into "User Data"
- "Continue"
-
Storage Configuration
- "Continue"
-
Tags
- "Continue"
-
Create Key Pair
- Choose a key of your choice, it will be added in addition to the one in the gist.
- "Continue"
-
Choose one or more of your existing Security Groups
- "flatcar-testing" as above.
- "Continue"
- Launch!
We will be launching three instances, with a few parameters in the User Data, and selecting our security group.
- Open the quick launch wizard to boot ami-0cd41626c2d7e7fef.
-
On the second page of the wizard, launch 3 servers to test our clustering
- Number of instances: 3
- Click "Continue"
- Next, we need to specify a discovery URL, which contains a unique token that allows us to find other hosts in our cluster. If you're launching your first machine, generate one at https://discovery.etcd.io/new?size=3, configure the `?size=` to your initial cluster size and add it to the metadata. You should re-use this key for each machine in the cluster.
-
Use ct to convert the following configuration into an Ignition config, and back in the EC2 dashboard, paste it into the "User Data" field.
wzxhzdk:5
- Paste configuration into "User Data"
- "Continue"
-
Storage Configuration
- "Continue"
-
Tags
- "Continue"
-
Create Key Pair
- Choose a key of your choice, it will be added in addition to the one in the gist.
- "Continue"
-
Choose one or more of your existing Security Groups
- "flatcar-testing" as above.
- "Continue"
- Launch!
Installation from a VMDK image¶
One of the possible ways of installation is to import the generated VMDK Flatcar image as a snapshot. The image file will be in https://${CHANNEL}.release.flatcar-linux.net/amd64-usr/${VERSION}/flatcar_production_ami_vmdk_image.vmdk.bz2
.
Make sure you download the signature (it's available in https://${CHANNEL}.release.flatcar-linux.net/amd64-usr/${VERSION}/flatcar_production_ami_vmdk_image.vmdk.bz2.sig
) and check it before proceeding.
$ wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_ami_vmdk_image.vmdk.bz2
$ wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_ami_vmdk_image.vmdk.bz2.sig
$ gpg --verify flatcar_production_ami_vmdk_image.vmdk.bz2.sig
gpg: assuming signed data in 'flatcar_production_ami_vmdk_image.vmdk.bz2'
gpg: Signature made Thu 15 Mar 2018 10:27:57 AM CET
gpg: using RSA key A621F1DA96C93C639506832D603443A1D0FC498C
gpg: Good signature from "Flatcar Buildbot (Official Builds) <buildbot@flatcar-linux.org>" [ultimate]
Then, follow the instructions in Importing a Disk as a Snapshot Using VM Import/Export. You'll need to upload the uncompressed vmdk file to S3.
After the snapshot is imported, you can go to "Snapshots" in the EC2 dashboard, and generate an AMI image from it.
To make it work, use /dev/sda2
as the "Root device name" and you probably want to select "Hardware-assisted virtualization" as "Virtualization type".
In the future we'll upload AMIs directly during the build process so this will be much easier.
Using Flatcar Container Linux¶
Now that you have a machine booted it is time to play around. Check out the Flatcar Container Linux Quickstart guide or dig into more specific topics.