FreeBSD on EC2
The following page detailed the state of FreeBSD/EC2 development until the
middle of 2015. EC2 is now fully supported by FreeBSD, with AMIs built by
the FreeBSD release engineering team and announced in
release and
snapshot
announcements; and this page is no longer being updated.
For lists of FreeBSD AMI IDs, please consult the appropriate FreeBSD release
announcement; you can also launch FreeBSD through the
AWS Marketplace.
If you wish to support my work on the FreeBSD/EC2 platform, I have a
Patreon; I'm also happy to
accept money in other ways if it's more convenient (send me an
email).
FreeBSD on EC2
The following FreeBSD AMIs are available (additional obsolete AMIs are
listed at the bottom of this page). For most users and applications,
the
FreeBSD 10.2-RELEASE for Current Generation instances AMI will
be the most appropriate one to use.
To use FreeBSD/EC2:
-
Decide which types of EC2 instances you want to use. There are different
FreeBSD/EC2 images for "Current Generation" EC2 instances (m3, c3, r3, i2,
and t2) vs. "Previous Generation" EC2 instances (m1, m2, c1, and t1). You
will almost always want to use the newer instance types; the only exception
is if you already own previous-generation reserved instances.
-
Decide which FreeBSD release you want. This will almost certainly be
either FreeBSD 10.2 (lots of new functionality, improved performance, and
the ability to use freebsd-update for system updates) or FreeBSD 9.3
(older but very extensively tested).
-
Based on the above two decisions, and the EC2 region you're using, look
up the AMI name in the table below.
-
Launch the EC2 instance.
-
If you're using FreeBSD 9.3 or later, you can provide launch-time configuration
settings via the EC2 "user-data" functionality and
configinit.
-
If you're using one of the "Previous Generation" AMIs, you may
need to adjust your EC2 "security group" settings to allow incoming TCP
connections on port 22 (EC2 thinks that those instances are "Windows" and
sets default firewall rules for Windows).
-
(Optional) Look at the EC2 instance console output ("Get System Log" on
the EC2 console) for the SSH host keys. Note that you may need to wait
about five minutes for these to appear. (You can also use my
ec2-knownhost
script to parse the EC2 console log and add keys to your ssh known_hosts
file automatically.)
-
SSH in as "ec2-user" (or the user you specified in the /etc/rc.conf
parameters you provided via configinit) using the SSH key you created for
EC2, and su to root (no password).
-
You can now use the EC2 instance like any other FreeBSD system, with the
exception that on versions prior to FreeBSD 9.3 you can't use FreeBSD
Update to fetch kernel security updates (you'll need to manually rebuild
and reinstall the XENHVM kernel).
FreeBSD version
us-east-1
(N Virginia)
us-west-1
(N California)
eu-west-1
(Ireland)
ap-southeast-1
(Singapore)
ap-northeast-1
(Tokyo)
us-west-2
(Oregon)
sa-east-1
(Sao Paulo)
ap-southeast-2
(Sydney)
eu-central-1
(Frankfurt)
FreeBSD 10.2-RELEASE
For Current Generation instances
ami-f709a29c
ami-bbc43aff
ami-5c4c112b
ami-fe6c62ac
ami-94209b94
ami-2b88821b
ami-49ef6754
ami-1bc28121
ami-2235323f
FreeBSD 10.1-RELEASE
For Current Generation instances
ami-34b5205c
ami-7ff6e03a
ami-3013a747
ami-988eadca
ami-e1d5ede0
ami-53fcb763
ami-ab70c6b6
ami-37d8b70d
ami-4a8eb857
FreeBSD 10.1-RELEASE
For 64-bit Previous Generation instances
ami-1eb42176
ami-2ff6e06a
ami-0c13a77b
ami-4c8dae1e
ami-67cbf366
ami-bbfcb78b
ami-0771c71a
ami-7fd8b745
n/a
FreeBSD 10.1-RELEASE
For 32-bit Previous Generation instances
ami-d0b520b8
ami-11f6e054
ami-2a13a75d
ami-aa8eadf8
ami-45cbf344
ami-41fcb771
ami-ef70c6f2
ami-1bd8b721
n/a
FreeBSD 9.3-RELEASE
For Current Generation instances
ami-b2a163da
ami-efebebaa
ami-d38453a4
ami-502a7302
ami-49b4e548
ami-7f344d4f
ami-0942ec14
ami-9da7c0a7
ami-f02a1ced
FreeBSD 9.3-RELEASE
For 64-bit Previous Generation instances
ami-80a765e8
ami-97ebebd2
ami-8f8453f8
ami-4a2a7318
ami-73b4e572
ami-51344d61
ami-bf5ef0a2
ami-9da2c5a7
n/a
FreeBSD 9.3-RELEASE
For 32-bit Previous Generation instances
ami-78a76510
ami-f9ebebbc
ami-b38453c4
ami-5e2a730c
ami-61b4e560
ami-61344d51
ami-4342ec5e
ami-97a7c0ad
n/a
FreeBSD 8.4-RELEASE
For Current Generation instances
ami-4761142e
ami-15eac450
ami-11908065
ami-e38cc2b1
ami-cf43cbce
ami-6369f853
ami-3ede7b23
ami-59e07363
n/a
FreeBSD 8.4-RELEASE
For 64-bit Previous Generation instances
ami-29611440
ami-31eac474
ami-bb9080cf
ami-978cc2c5
ami-f743cbf6
ami-5769f867
ami-30de7b2d
ami-bfe07385
n/a
FreeBSD 8.4-RELEASE
For 32-bit Previous Generation instances
ami-5f611436
ami-21eac464
ami-d79080a3
ami-eb8cc2b9
ami-eb43cbea
ami-5369f863
ami-3ade7b27
ami-43e07379
n/a
EC2 quirks
In order to work with EC2, the FreeBSD AMIs are slightly modified from
what you would have immediately after installing FreeBSD from a release
CD:
-
The network is configured and the sshd daemon is enabled, for obvious
reasons.
-
On AMIs up to and including FreeBSD 9.1-RC1 or 8.3-RELEASE: SSH logins as
root are enabled, but root's password is starred out (i.e., password logins
as root will fail until a password is set).
-
From FreeBSD 9.1-RC2 and 8.4-BETA1 onwards, you will need to login as
"ec2-user" (from 10.0-RELEASE onwards, this can be changed via
configinit) and su to root.
-
The first time an AMI is booted, a script fetches the public half of
an SSH keypair from EC2 and arranges for logins using that key.
-
Every time the the AMI boots, it prints the SSH host keys to the console
in the same format as Amazon Linux AMIs do.
-
In the default configuration, kernel panics (including backtraces) are
reported to the FreeBSD/EC2 maintainer to assist him in identifying and
fixing bugs.
-
Onr releases prior to 10.0-RELEASE, some EC2-specific patches have been
applied to FreeBSD in order to improve performance and work around bugs.
These are contained in /root/ec2-bits/*.patch.
-
Because EC2 AMIs prior to 10.0-BETA1 have non-GENERIC kernels, FreeBSD
Update cannot update their kernels. Updating should be performed by
using FreeBSD Update to update the /usr/src tree and then
rebuilding the kernel from source. (10.0-BETA1 and later have GENERIC
kernels and can use FreeBSD Update for everything.)
Packaging new AMIs
The process of building FreeBSD AMIs from scratch is non-trivial; it
is much easier to modify and re-bundle one of the existing FreeBSD AMIs:
-
Launch the FreeBSD AMI you want to base your AMI on.
-
Make your changes (installing packages, adjusting configurations, etc).
-
Delete the file /root/.ssh/authorized_keys or
/home/ec2-user/.ssh/authorized_keys (otherwise your SSH
key will be able to log in to any instances launched from this AMI).
-
Create the file /firstboot on 10.0-RELEASE or
/root/firstboot on earlier releases (otherwise the AMI you create
won't know to download the new SSH public key for logins).
-
Stop the instance (but do not terminate it).
-
Use the ec2-create-image tool or the "Create Image" command in the EC2
Management Console to create an AMI from the instance.
-
Terminate the instance.
About the author
This page is maintained, and the FreeBSD AMIs were produced, by Colin
Percival — a FreeBSD developer, a member of the FreeBSD Core team,
and the FreeBSD Security Officer. Work to get FreeBSD working on
cc1.4xlarge instances was sponsored by
SegPub.
Work to get FreeBSD 7.4 working on EC2, fix bugs, and improve network
performance was sponsored by
LineRate Systems.
Work to get FreeBSD working on "defenestrated" Windows instances and to
further improve network performance was sponsored by an anonymous donor.
Colin is available
for consulting on FreeBSD/EC2 if anyone wants to support further
work on FreeBSD/EC2. When he's not working on FreeBSD, Colin spends
most of his time running his
online backup service.