Skip to content

aws4embeddedlinux/meta-aws-ewaol

The meta-aws-ewaol repository

This repository provides the example code and instructions for building a customized Edge Workload Abstraction and Orchestration Layer (EWAOL) distribution in form of an Amazon Machine Image (AMI).

minimal suggested infrastructure

Build instructions

Pre-requisites

  1. An AWS account and the necessary IAM rights to create EC2 instances, EBS snapshots, EBS volumes, S3 buckets, and IAM roles and policies.

  2. A VPC with appropriate subnets and routing required to access the build server.

  3. The resources created by deploying the VMImport CloudFormation Template (roles, policies, S3 bucket for images).

    1. Take note of the outputs of the stack deployment as they'll be needed in the following steps.
  4. An arm64 Ubuntu 20.04 EC2 instance using a Graviton processor (e.g. c6g.4xlarge) with 150GB+ root disk with internet access using the instance profile created by the CloudFormation template from previous step (VMBuilderEC2Role).

Build Dependencies

  1. Update the Operating System and install the pre-requisites for Yocto, Kas, and our image creation script:

    sudo apt-get update
    sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev make python3-pip jq zstd liblz4-tool qemu-utils
  2. Install AWS CLI v2:

    curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "/tmp/awscliv2.zip"
    unzip /tmp/awscliv2.zip -d /tmp
    sudo /tmp/aws/install
  3. Install the python packages:

    sudo pip3 install sphinx sphinx_rtd_theme pyyaml kas==3.0.2 git-remote-codecommit

Building EWAOL

  1. Clone the repo from the instance or upload the code and invoke the build command. For example:

    git clone https://github.com/aws4embeddedlinux/meta-aws-ewaol.git
    cd meta-aws-ewaol
  2. Customize the ewaol-graviton2-ami.yaml as needed and invoke the build:

    kas build kas/machines/ewaol-graviton2-ami.yaml

Creating AMI from image file

From meta-aws-ewaol directory, run the bash script. Replace <S3_BUCKET_IMPORT_IMAGES> with the bucket name created by the CloudFormation Stack in the pre-requisites section, then choose the appropriate size which the future root disk of the AMI should have by entering a number (e.g. 16) in place of <AMI_DISK_SIZE_IN_GB> :

bash scripts/create-ami.sh <S3_BUCKET_IMPORT_IMAGES> <AMI_DISK_SIZE_IN_GB>

Launch the EC2 Image as usual using your newly created AMI

  1. In the Web Console, Navigate to EC2->Images->AMIs.
  2. Select the desired AMI and click 'Launch instance from Image'.
  3. Follow the wizard as usual.
  4. Access the image with the previously provided ssh key with user ewaol.

Limitations

The image does not yet support online expansion of partitions/filesystems via cloud-init. Follow the below workaround to expand the root partition and filesystem (this can be used as a user data script):

#!/bin/sh

# disabling swap
swapoff -a
sed -i '/.*swap.*/d' /etc/fstab
# trick to fix GPT
printf "fix\n" | parted ---pretend-input-tty /dev/nvme0n1 print
# remove partition 3 (swap)
parted -s /dev/nvme0n1 rm 3
# resize partition 2 to use 100% of available free space
parted -s /dev/nvme0n1 resizepart 2 100%
# resizing ext4 filesystem
resize2fs /dev/nvme0n1p2

Future Enchancements

  • Enable support for expanding the filesystem on boot with cloud-init which depends on growpart. This needs cloud-utils which is not in openembedded recipes yet.

Security

See CONTRIBUTING for more information.

License

This code is licensed under the MIT-0 License. See the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages