diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2024-08-31 23:55:06 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2024-09-11 05:28:59 +0000 |
commit | 953142d6baf3f0fcde98da9455f5936f735613fb (patch) | |
tree | 721d7fc16979d892b55aae652d96c4157d38c5ac | |
parent | 6a9e7f6a1d35e7b7385aa4ae1bbfb65cf8ea0c65 (diff) |
EC2: Add new "small" AMIs
These are the same as the standard "base" images except:
* They don't have kernel or world debug symbols,
* They don't have FreeBSD tests,
* They don't have 32-bit libraries,
* They don't have LLDB,
* They don't have the Amazon SSM Agent pre-installed,
* They don't default to installing the awscli at first boot.
This reduces the amount of disk space in use when the EC2 instance
finishes booting from ~5 GB to ~1 GB.
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D46509
(cherry picked from commit 647299caa06e38622dc05a4358f9407b62a9bdda)
-rw-r--r-- | release/Makefile.vm | 3 | ||||
-rw-r--r-- | release/tools/ec2-small.conf | 44 |
2 files changed, 46 insertions, 1 deletions
diff --git a/release/Makefile.vm b/release/Makefile.vm index 8c48c0a13dc9..3bfe2d8bfee0 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -35,9 +35,10 @@ BASIC-CLOUDINIT_FSLIST?= ufs zfs BASIC-CLOUDINIT_DESC?= Images for VM with cloudinit disk config support EC2_FORMAT= raw EC2_FSLIST?= ufs zfs -EC2_FLAVOURS?= BASE CLOUD-INIT +EC2_FLAVOURS?= BASE CLOUD-INIT SMALL EC2-BASE_DESC= Amazon EC2 image EC2-CLOUD-INIT_DESC= Amazon EC2 Cloud-Init image +EC2-SMALL_DESC= Amazon EC2 small image GCE_FORMAT= raw GCE_FSLIST?= ufs zfs GCE_DESC= Google Compute Engine image diff --git a/release/tools/ec2-small.conf b/release/tools/ec2-small.conf new file mode 100644 index 000000000000..858836717f5a --- /dev/null +++ b/release/tools/ec2-small.conf @@ -0,0 +1,44 @@ +#!/bin/sh + +. ${WORLDDIR}/release/tools/ec2.conf + +# Build with a 4.9 GB partition; the growfs rc.d script will expand +# the partition to fill the root disk after the EC2 instance is launched. +# Note that if this is set to <N>G, we will end up with an <N+1> GB disk +# image since VMSIZE is the size of the filesystem partition, not the disk +# which it resides within. (This overrides the default in ec2.conf.) +export VMSIZE=5000m + +# Flags to installworld/kernel: We don't want debug symbols (kernel or +# userland), 32-bit libraries, tests, or the debugger. +export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \ + WITHOUT_LIB32=YES WITHOUT_TESTS=YES WITHOUT_LLDB=YES" + +# Packages to install into the image we're creating. In addition to packages +# present on all EC2 AMIs, we install: +# * ec2-scripts, which provides a range of EC2ification startup scripts, +# * firstboot-freebsd-update, to install security updates at first boot, +# * firstboot-pkgs, to install packages at first boot, and +# * isc-dhcp44-client, used for IPv6 network setup. +export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} ec2-scripts \ + firstboot-freebsd-update firstboot-pkgs isc-dhcp44-client" + +# Services to enable in rc.conf(5). +export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \ + ec2_fetchkey ec2_loghostkey firstboot_freebsd_update firstboot_pkgs \ + growfs sshd" + +vm_extra_pre_umount() { + # Any EC2 ephemeral disks seen when the system first boots will + # be "new" disks; there is no "previous boot" when they might have + # been seen and used already. + touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen + + # Configuration common to all EC2 AMIs + ec2_common + + # Standard FreeBSD network configuration + ec2_base_networking + + return 0 +} |