> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formae.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Base VPC networking

> An AWS infrastructure pattern, deployed with formae.

The foundational network that other workloads build on, meant to be applied
holistically in reconcile mode from a Git repository. One forma provisions a
VPC, an internet gateway, two public subnets, a public route table with its
route and subnet associations, and two security groups (one for a load balancer,
one for tasks) where the task security group accepts traffic from the load
balancer security group.

```mermaid theme={"languages":{"custom":["/languages/pkl.json"]}}
flowchart LR
  target["aws-target"]:::tgt

  subgraph stack["lifeline"]
    direction LR
    vpc["VPC"]:::res
    igw["Internet gateway"]:::res
    subnets["Public subnets"]:::res
    routing["Route table + routes + associations"]:::res
    albSg["ALB security group"]:::res
    taskSg["Task security group"]:::res

    vpc --> igw
    vpc --> subnets
    vpc --> routing
    igw --> routing
    subnets --> routing
    vpc --> albSg
    vpc --> taskSg
    albSg --> taskSg
  end

  target --> stack

  classDef tgt fill:#FF8201,stroke:#B25900,color:#ffffff
  classDef res fill:#FFF3E6,stroke:#FF8201,color:#02024B
  style stack fill:#ffffff,stroke:#02024B,stroke-width:2px,stroke-dasharray:6 4,color:#02024B
```

**Deploy.** Apply the example forma. formae brings up the VPC before the subnets,
route table, and security groups that reference it:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae apply --mode reconcile \
  /opt/pel/formae/examples/formae-plugin-aws/lifeline/basic_infrastructure.pkl
```

**Verify.** Once the command completes, the VPC is under management:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae inventory resources --query="type:AWS::EC2::VPC"
```

**Tear down.** Remove everything the forma created:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae destroy \
  /opt/pel/formae/examples/formae-plugin-aws/lifeline/basic_infrastructure.pkl
```

The full forma is in the
[lifeline example](https://github.com/platform-engineering-labs/formae-plugin-aws/tree/main/examples/lifeline).
