The AWS CLI is a tool set that lets you manage your AWS resources. The CLI comes in two versions which, at the time of this writing, are developed concurrently: version 1 and version 2.

Internally, the AWS CLIv1 and v2 are quite different. Version 2 pulls in AWS libraries--libraries which are used across the AWS SDK ecosystem--rather than reinventing the wheel when it comes to common tasks, such as talking to Amazon S3. Running AWS CLIv2 on your operating system of choice requires building and installing these common AWS libraries.

I contributed changes to s2n-tls, aws-lc, the Python runtime, some build tooling, and various other libraries. As a result, the AWS CLIv2 now builds and runs on OpenBSD.

To make installation simple, I've created an OpenBSD port for CLIv2 and its dependencies. Instructions for installing the port are below.

AWS CLIv2 features

AWS CLIv2 offers these features over v1:

  • Wizards which guide you through constructing certain commands (eg, aws configure wizard or aws dynamodb wizard new-table).
  • Auto-prompt which can prompt you for commands, parameters, and resources when you run aws commands.
  • YAML-stream output format.
  • High-level ddb commands for DynamoDB (eg, aws ddb put and aws ddb select).
  • aws logs tail command which tails the logs for an Amazon CloudWatch Logs group.

Installation

To install the AWS CLIv2 port:

1 - Clone the repository from GitHub:

git clone https://github.com/knightjoel/awscliv2-on-openbsd

2 - Copy the contents of the repo's ports/ directory to /usr/ports (or wherever your ports tree is).

cd awscliv2-on-openbsd/ports
cp -a * /usr/ports

3 - Install some packages needed to build the port. You could allow ports to build and install this software, but installing the packages will reduce the build time.

doas pkg_add cmake python%3 ninja

4 - Install the AWS CLIv2 port.

If you have v1 of the AWS CLI installed, you'll have to uninstall it first.

doas pkg_delete awscli
cd /usr/ports/sysutils/awscliv2
make install

5 - Verify installation

% aws --version
aws-cli/2.13.9 Python/3.10.11 OpenBSD/7.3 source/amd64 prompt/off

FAQs

What version(s) of OpenBSD is this tested on?

The port is tested and used on OpenBSD 7.2/amd64, 7.3/amd64, and 7.3/arm64.

Why isn't this part of the official OpenBSD ports tree?

I have submitted this port for inclusion in the ports tree and made modifications based on the feedback I've received, but there is reluctance to merge it due to how the AWS CLIv2 defines its Python dependencies (and the resulting burden that would place on ports maintainers when updating those third-party dependencies). I'm hopeful this will improve over time and this port will make it into the tree.

What are the advantages of AWS CLI v2?

Please see the list above.

If you enjoy AWS CLIv2 on non-OpenBSD systems, you can now have feature parity across those systems and OpenBSD when using the AWS CLI.

Does this replace the sysutils/awscli (AWS CLIv1) port?

No.

Since AWS continues to concurrently develop and release v1 and v2 of the CLI, I chose to create a separate port for CLIv2 to give OpenBSD users the choice of which version they want to install.

Can I have the v1 and v2 port installed at the same time?

Because both versions of the AWS CLI port install files in the same location with the same name, the ports cannot be installed at the same time. The v2 port has a conflict annotation so it knows not to install if the v1 port is installed. The v1 port does not yet have such an annotation so you must take care yourself not to install the v1 port while the v2 port is installed.

Can you provide a pre-built package I can install with pkg_add?

No, I'm not able to do that.


Disclaimer: The opinions and information expressed in this blog article are my own and not necessarily those of Amazon Web Services or Amazon, Inc.