EC2 (Virtual Machines)
Overview
EC2 add-ons provide virtual machine instances for specialized workloads that need full operating system access, custom software, or workloads that don’t fit into containers. Tapitalee provisions Amazon EC2 instances in your VPC and provides SSH access through your public key.
Purpose and Benefits
- Full OS Access: Complete control over the operating system environment
- Custom Software: Run software that cannot be containerized easily
- Persistent Compute: Long-running compute tasks outside of ECS
- Specialized Hardware: Access to specific instance types with GPU or high-memory configurations
- SSH Access: Direct secure shell access to instances using your SSH key
Use Cases
- Build Servers: Custom build infrastructure
- Database Proxies: Dedicated proxy servers for database connections
- Bastion Hosts: Secure jump servers for system access
- Legacy Applications: Applications that require traditional server environments
- GPU Workloads: Machine learning inference or training
CLI Usage
Create EC2 Instance
Create an EC2 instance for custom workloads
tapit create ec2 name=instance-name [size|open_ports|allowed_ip_ranges|ssh_public_key|storage|ami]='...' [--ignore-existing]
Parameters
name: Name for the EC2 instance (required)size: EC2 instance type (default: t3.micro)open_ports: Ports to open (e.g., ‘22,80,443’)allowed_ip_ranges: IP address, CIDR ranges, or special values app/vpc/all, that are allowed to access the instance, separated by commasssh_public_key: SSH public key for accessstorage: Root volume size in GB (default: 10)ami: Custom AMI ID to use--ignore-existing: Skip creation if a resource with the same name already exists (useful for idempotent scripts)
Examples
# Create a basic EC2 instance
tapit create ec2 name=build-server
# Create with specific instance type and SSH access
tapit create ec2 name=bastion size=t3.micro ssh_public_key='ssh-rsa AAAA...'
# Create with custom ports and allowed IPs
tapit create ec2 name=proxy size=t3.small open_ports=8080,8443 allowed_ip_ranges=10.0.0.0/8
# Create with larger storage
tapit create ec2 name=data-processor size=c6i.large storage=200
Modify EC2 Instance
Update settings for an existing EC2 instance
tapit set ec2 name=instance-name [size|open_ports|allowed_ip_ranges|storage|disabled|delete_protection]='...'
Parameters
name: Name of the EC2 instance to update (required)size: EC2 instance type (default: t3.micro)open_ports: Ports to open (e.g., ‘22,80,443’)allowed_ip_ranges: IP address, CIDR ranges, or special values app/vpc/all, that are allowed to access the instance, separated by commasstorage: Root volume size in GB (default: 10)disabled: Stop (true) or start (false) the EC2 instancedelete_protection: Enable (true) delete protection for the instance (cannot be disabled once enabled)
Examples
# Upgrade instance size
tapit set ec2 name=build-server size=c6i.xlarge
# Stop the instance (saves compute costs)
tapit set ec2 name=build-server disabled=true
# Restart the instance
tapit set ec2 name=build-server disabled=false
# Update open ports
tapit set ec2 name=proxy open_ports=80,443,8080
Restart EC2 Instance
Restart an add-on if restartable (e.g., restart a SecureProxy or similar containerised add-on)
tapit restart addon name=addon_name
Parameters
name: Name of the add-on to restart (required)
Restarts the EC2 instance.
List and Show EC2 Instances
List all add-ons attached to the app with their state and configuration
tapit list addons [-w|--wait]
Parameters
-w|--wait: Wait until all add-ons reach a stable state (fully ready or fully deleted); exits non-zero if any add-on is in a failed state
Show detailed information about a specific add-on
tapit show addon name=addon_name
Parameters
name: Name of the add-on to show (required)
Delete EC2 Instance
Delete an add-on and all its associated AWS resources
tapit delete addon name=addon_name
Parameters
name: Name of the add-on to delete (required)
Warning: This permanently terminates the EC2 instance and deletes all data on it.
Snapshots
Tapitalee automatically takes daily EBS snapshots of EC2 instances, retaining 3 days of backups. You can also create manual snapshots:
# Create a manual snapshot
tapit create snapshot addon=instance-name name=before-upgrade
# List snapshots
tapit list snapshots addon=instance-name
IP Address
Tapitalee allocates a static public IP address (AWS Elastic IP) for each EC2 instance. This IP address does not change for the lifetime of the add-on.
To find the IP address of your instance, use the UI or run:
tapit show addon name=instance-name
Each instance also has an internal (private) VPC IP address, shown as “Internal IP” in the UI and as internal_ip in tapit show addon. If the instance has an IPv6 address, it is shown as well.
If you set allowed_ip_ranges=app, access is restricted to your app’s own containers (and the containers of any apps the add-on is shared with). In that case the public Elastic IP will not accept connections from those containers, so your app must connect to the instance using its internal IP address:
tapit set ec2 name=proxy allowed_ip_ranges=app
tapit show addon name=proxy # read internal_ip
No environment variables are injected into your app for EC2 instances, so pass the internal IP to your app yourself (for example via a config variable).
Cost Optimization
- Use
disabled=trueto stop instances when not needed (you still pay for EBS storage but not compute) - Choose the smallest instance type that meets your requirements