I have seen this question Creating you own FreeBSD ami in EC2 which may or may not be outdated now as time has passed.
Looking at Mr. Percival's site it does appear to be possible to do this. For example
My goal was to build from source at a specific revision (to align with the rest of my servers), with a custom kernel; so I intended to
installkernel into some UFS partition that would end up being the 'root' partition of the resulting AMI.
I also only wanted to have an EBS device of at most 3GB, since the base system is small and my application data would be on other volumes running ZFS.
As described on the website, the FreeBSD AMI-builder boots into a memory disk, allowing manipulation of the EBS backing store device (what is to become the EBS backing store for the resulting AMI). In particular the device can be manipulated with
gpart, its partitions deleted, resized, etc; and the contents of the "main" partition, which appears to start out with a more-or-less stock FreeBSD installation, can also be changed.
The procedure is then to use the existing AWS interface to create an AMI from the instance, running the AMI-builder, whose EBS backing-store device has been modified. I have managed to get a system running in this manner by not modifying the system at all in the AMI-builder.
However if I try to
mergemaster, and shrink the partition (so that I can put another partition on the device, to make use of the rest of the 10GB, which is the size of the EBS backing-store provided), instances launched using the resulting AMI do not proceed past 'Initializing' status and connection attempts time out. If I try the same installation after creating first an unmodified AMI using the AMI builder (i.e. previous paragraph), and restart, the instance proceeds into 'running', '2/2 status checks', but connections continue to time out.
Indeed, there must be some functionality slipped into the more-or-less stock copy of FreeBSD present on the AMI-builder's backing-store device, and it seems that I must be overwriting it with my modifications. The most important of that functionality seems to be in the
sysutils/ec2-scripts package, but I am not making any changes to that packages. There may be modifications elsewhere, such as in /boot.
I would like to get a system that is as close as possible to being "stock" while still being compatible with EC2. I would also like to be able to choose the size of the UFS partition since I will not be able to use the full 10GB on UFS.
I welcome any advice on this.