CLI: VPC, Subnet & Security Group

Manage VPCs, subnets, and security groups with the agentmetal CLI.

CLI: VPC, Subnet & Security Group

Overview

Network resources form the foundation of your infrastructure. The agentmetal vpc, agentmetal subnet, and agentmetal security-group subcommands manage virtual private clouds, subnets, and firewall rules respectively.

VPC Operations

Create a VPC

agentmetal vpc create --name production --cidr 10.0.0.0/16
FlagRequiredDescription
--nameYesVPC name
--cidrYesCIDR block for the VPC (e.g., 10.0.0.0/16)
### List VPCs
agentmetal vpc list
ID          NAME         CIDR            STATE
vpc-a1b2c3  production   10.0.0.0/16     active
vpc-d4e5f6  staging      10.1.0.0/16     active

Get / Delete

agentmetal vpc get vpc-a1b2c3
agentmetal vpc delete vpc-a1b2c3

Subnet Operations

Create a Subnet

agentmetal subnet create \
  --name web-tier \
  --vpc vpc-a1b2c3 \
  --cidr 10.0.1.0/24 \
  --zone fsn1-dc14
FlagRequiredDescription
--nameYesSubnet name
--vpcYesParent VPC ID
--cidrYesCIDR block within the VPC range
--zoneNoAvailability zone
### List / Get / Delete
agentmetal subnet list --vpc vpc-a1b2c3
agentmetal subnet get subnet-abc123
agentmetal subnet delete subnet-abc123

Security Group Operations

Create a Security Group

agentmetal security-group create \
  --name web-sg \
  --vpc vpc-a1b2c3 \
  --rule "ingress,tcp,80,0.0.0.0/0" \
  --rule "ingress,tcp,443,0.0.0.0/0" \
  --rule "ingress,tcp,22,10.0.0.0/16"

Rules follow the format: direction,protocol,port,cidr.

FlagRequiredDescription
--nameYesSecurity group name
--vpcYesParent VPC ID
--ruleNoFirewall rule (repeatable)
### List / Get / Delete
agentmetal security-group list --vpc vpc-a1b2c3
agentmetal security-group get sg-abc123
agentmetal security-group delete sg-abc123

Full Network Setup Example

# 1. Create the VPC
agentmetal vpc create --name prod --cidr 10.0.0.0/16

2. Create subnets

agentmetal subnet create --name web --vpc vpc-abc --cidr 10.0.1.0/24 agentmetal subnet create --name db --vpc vpc-abc --cidr 10.0.2.0/24

3. Create security groups

agentmetal security-group create --name web-sg --vpc vpc-abc \ --rule "ingress,tcp,80,0.0.0.0/0" \ --rule "ingress,tcp,443,0.0.0.0/0"

agentmetal security-group create --name db-sg --vpc vpc-abc \ --rule "ingress,tcp,5432,10.0.1.0/24"