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:
-
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
-
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
-
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:
-
EC2 Instance Creation: The
StartEc2
function now accepts avolumeSize
parameter that is passed directly to the AWS EC2 API when configuring the EBS block device mapping. -
Command Line Interface: Both the Linux (
launch
) and Windows (launch-windows
) commands have been updated with the new--volume-size
flag. -
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:
- Log Storage: Your bastion needs to store extensive audit logs or session recordings
- Temporary Files: Applications or scripts running on the bastion require significant temporary storage
- Software Installation: You need to install additional software packages that require more disk space
- Data Transfer: The bastion is used as an intermediary for file transfers requiring staging space
Volume Size Recommendations
- Minimal Usage (8-16GB): Standard SSH jump host functionality with basic logging
- Moderate Usage (20-50GB): Enhanced logging, temporary file storage, or light application hosting
- Heavy Usage (50GB+): Extensive logging requirements, large file transfers, or running storage-intensive applications
Cost Considerations
Remember that larger EBS volumes incur higher AWS costs. Consider:
- Using the minimum volume size that meets your requirements
- Implementing log rotation and cleanup policies
- Monitoring disk usage to right-size your volumes
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.