Bastion CLI - Custom Volume Size Support

Introduction

The bastion-cli tool has been enhanced with a new feature that allows users to specify custom EBS volume sizes when launching bastion instances. This update provides greater flexibility in managing storage requirements for both Linux and Windows bastion hosts, moving beyond the previous fixed 8GB volume size limitation.

This enhancement is particularly valuable for scenarios where bastion hosts need additional storage capacity for logs, temporary files, or when running applications that require more disk space than the default allocation.

Features

Custom Volume Size Configuration

The new --volume-size flag has been added to both Linux and Windows bastion launch commands, enabling users to specify the desired EBS volume size in gigabytes (GB).

Key Enhancements:

  1. Flexible Storage Allocation

    • Users can now specify any volume size based on their requirements
    • Default volume size remains at 8GB for backward compatibility
    • Volume size is specified in gigabytes (GB) as an integer value
  2. Integration with Existing Volume Options

    • Works seamlessly with existing volume configuration options
    • Compatible with all supported volume types (gp2, gp3, io2, io1)
    • Maintains support for volume encryption settings
  3. Consistent Implementation

    • Available for both Linux and Windows bastion instances
    • Integrated into the existing command structure
    • No breaking changes to existing workflows

Technical Implementation Details

The implementation modifies three key components of the bastion-cli:

  1. EC2 Instance Creation: The StartEc2 function now accepts a volumeSize parameter that is passed directly to the AWS EC2 API when configuring the EBS block device mapping.

  2. Command Line Interface: Both the Linux (launch) and Windows (launch-windows) commands have been updated with the new --volume-size flag.

  3. Default Behavior: When the --volume-size flag is not specified, the system maintains the previous default of 8GB, ensuring backward compatibility.

Examples

Launching a Linux Bastion with Custom Volume Size

To launch a Linux bastion with a 20GB EBS volume:

bastion launch --volume-size 20

Launching a Windows Bastion with Custom Volume Size

To launch a Windows bastion with a 50GB EBS volume:

bastion launch-windows --volume-size 50

Combining with Other Volume Options

You can combine the volume size option with other volume-related flags:

# Launch with 30GB gp3 encrypted volume
bastion launch --volume-size 30 --volume-type gp3 --volume-encryption

# Launch Windows bastion with 100GB io2 volume
bastion launch-windows --volume-size 100 --volume-type io2

Using Default Volume Size

If you don’t specify the --volume-size flag, the bastion will be created with the default 8GB volume:

# These commands will create bastions with 8GB volumes
bastion launch
bastion launch-windows

Usage Guidelines

When to Use Custom Volume Sizes

Consider specifying a custom volume size when:

Volume Size Recommendations

Cost Considerations

Remember that larger EBS volumes incur higher AWS costs. Consider:

Conclusion

The addition of custom volume size support to bastion-cli provides users with the flexibility to tailor their bastion instances to specific storage requirements. This enhancement maintains the tool’s ease of use while adding a powerful configuration option that addresses real-world scenarios where the default 8GB volume size may be insufficient.

The implementation ensures backward compatibility while providing a straightforward path for users who need additional storage capacity. Whether you’re managing audit logs, transferring files, or running applications on your bastion hosts, the custom volume size feature ensures you have the storage resources necessary for your use case.

For more information about bastion-cli and its features, visit the bastion-cli GitHub repository.