Skip to content

Commit cb88df4

Browse files
svallerue2b-bot[bot]
authored andcommitted
feat(embed): terraform module for aws
GitOrigin-RevId: 67dcaf34ed0c4f487046377f678850aaecb78534
1 parent 38ba45f commit cb88df4

19 files changed

Lines changed: 2384 additions & 82 deletions

File tree

‎embed/.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ compose/env/*.local.env
1010
# tracked on purpose.
1111
!/compose/.env
1212

13-
# `make lint` runs `terraform init` in the module and in the example, through a
13+
# `make lint` runs `terraform init` in each module and each example, through a
1414
# shared plugin cache; a module needs no lock file, so none of that is tracked.
1515
.terraform/
1616
.terraform-cache/

‎embed/Makefile‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SHELL := /bin/bash
22
.PHONY: lint config test images stores-check vector-validate otel-validate sync-configs kubernetes-render terraform-validate
33

44
# Every compose invocation runs against compose/, where compose.yaml and .env
5-
# live; the other two install shapes have their own directories beside it.
5+
# live; the other three install shapes have their own directories beside it.
66
COMPOSE := docker compose --project-directory compose
77

88
SHELL_FILES := $(strip $(wildcard compose/scripts/*.sh))
@@ -21,16 +21,24 @@ lint: config vector-validate otel-validate kubernetes-render terraform-validate
2121
kubernetes-render:
2222
kubectl kustomize kubernetes >/dev/null
2323

24-
# Both roots share one plugin cache, so the providers are downloaded once. The
25-
# example is validated too: a renamed input or output is exactly how a
26-
# copy-paste example goes stale.
24+
# All four roots share one plugin cache, so each provider is downloaded once.
25+
# Terraform reads that cache only for providers a lock file already lists
26+
# unless told otherwise, and none of these roots tracks a lock file
27+
# (.gitignore), so there is none to keep. The examples are validated too: a
28+
# renamed input or output is exactly how a copy-paste example goes stale.
29+
TF_CACHE := TF_PLUGIN_CACHE_DIR=$(CURDIR)/.terraform-cache TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE=true
2730
terraform-validate:
2831
mkdir -p .terraform-cache
29-
TF_PLUGIN_CACHE_DIR=$(CURDIR)/.terraform-cache terraform -chdir=terraform/gcp init -backend=false -input=false >/dev/null
32+
$(TF_CACHE) terraform -chdir=terraform/gcp init -backend=false -input=false >/dev/null
3033
terraform -chdir=terraform/gcp fmt -check -recursive
3134
terraform -chdir=terraform/gcp validate
32-
TF_PLUGIN_CACHE_DIR=$(CURDIR)/.terraform-cache terraform -chdir=terraform/gcp/examples/basic init -backend=false -input=false >/dev/null
35+
$(TF_CACHE) terraform -chdir=terraform/gcp/examples/basic init -backend=false -input=false >/dev/null
3336
terraform -chdir=terraform/gcp/examples/basic validate
37+
$(TF_CACHE) terraform -chdir=terraform/aws init -backend=false -input=false >/dev/null
38+
terraform -chdir=terraform/aws fmt -check -recursive
39+
terraform -chdir=terraform/aws validate
40+
$(TF_CACHE) terraform -chdir=terraform/aws/examples/basic init -backend=false -input=false >/dev/null
41+
terraform -chdir=terraform/aws/examples/basic validate
3442

3543
# Vector parses the config and compiles its VRL without connecting to sinks.
3644
# Catches a broken remap or a misspelled sink option before a host does.

‎embed/README.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
# E2B Embed
77

8-
**A complete E2B, sandboxes included, on one machine you own.** Three ways to
8+
**A complete E2B, sandboxes included, on one machine you own.** Four ways to
99
get that machine running, all of them the same stack.
1010

1111
[Docker Compose](compose/README.md)
1212
| [Terraform on GCP](terraform/gcp/README.md)
13+
| [Terraform on AWS](terraform/aws/README.md)
1314
| [Kubernetes](kubernetes/README.md)
1415
| [Reference](docs/REFERENCE.md)
1516
| [Releasing](../docs/RELEASING.md)
@@ -22,12 +23,13 @@ get that machine running, all of them the same stack.
2223
|-------|---------------|-------------|-------|
2324
| Docker Compose | a Linux host with KVM that you may mutate | `docker compose up -d --wait` | [`compose/README.md`](compose/README.md) |
2425
| Terraform on GCP | a GCP project and credentials | `terraform apply` | [`terraform/gcp/README.md`](terraform/gcp/README.md) |
26+
| Terraform on AWS | an AWS account and credentials | `terraform apply` | [`terraform/aws/README.md`](terraform/aws/README.md) |
2527
| Kubernetes | a cluster with one KVM node | `kubectl apply -k` | [`kubernetes/README.md`](kubernetes/README.md) |
2628

2729
Compose and Terraform run [`compose/compose.yaml`](compose/compose.yaml) and
2830
[`compose/.env`](compose/.env) as shipped. Kubernetes runs a StatefulSet
2931
translated from them, with the same pins in
30-
[`kubernetes/kustomization.yaml`](kubernetes/kustomization.yaml). All 3 are
32+
[`kubernetes/kustomization.yaml`](kubernetes/kustomization.yaml). All 4 are
3133
single-machine evaluation packages, not deployment patterns. For a production
3234
deployment see [e2b.dev/enterprise](https://e2b.dev/enterprise).
3335

@@ -117,8 +119,8 @@ collector and the pprof endpoints stay on loopback;
117119

118120
- `make images` builds the 3 stack images locally under their pinned tags.
119121
- `make lint` renders the compose file and the kustomization, validates the
120-
Vector config and the Terraform module, and shellchecks the scripts and the
121-
tests.
122+
Vector config and the 2 Terraform modules, and shellchecks the scripts and
123+
the tests.
122124
- `make test` runs the bats suite in `tests/`.
123125
- `make stores-check` runs the store-level integration check.
124126
- `make sync-configs` re-inlines the 3 configs into the compose file.

‎embed/compose/README.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ the hub is [`../README.md`](../README.md).
1111
- Linux x86-64 or arm64 with KVM and a 4 KiB-page kernel (Ubuntu's default
1212
on both), on a host you own and may mutate: bare metal, or a VM created with
1313
nested virtualization enabled (on GCE, `--enable-nested-virtualization`; on
14-
Apple silicon, a Lima or other Virtualization.framework VM with nested
15-
virtualization on, which needs an M3 or newer and macOS 15 or newer). x86-64
14+
EC2, `--cpu-options NestedVirtualization=enabled` on an Intel type that
15+
offers it, such as `m8i`; on Apple silicon, a Lima or other
16+
Virtualization.framework VM with nested virtualization on, which needs an
17+
M3 or newer and macOS 15 or newer). x86-64
1618
is what the guides were written and tested on. arm64 is verified end to
1719
end on bare metal: on 2026-09-14 a bare-metal arm64 host (a GCE `c4a` metal
1820
instance, Ubuntu 26.04, kernel 7.0) reached `ready` in under two minutes
@@ -37,7 +39,9 @@ the hub is [`../README.md`](../README.md).
3739
- `/dev/kvm` and `/dev/net/tun` present. On a VM, `/dev/kvm` means nested
3840
virtualization is enabled for it; on GCE, stop the VM, run
3941
`gcloud compute instances update <vm> --enable-nested-virtualization`, and
40-
start it again. Without either device, `up` stops at `preflight` with a
42+
start it again; on EC2, stop the instance, run
43+
`aws ec2 modify-instance-cpu-options --instance-id <id> --nested-virtualization enabled`,
44+
and start it again. Without either device, `up` stops at `preflight` with a
4145
`FIX:` line and nothing that needs KVM is started.
4246
- Docker Engine 27 or newer with Compose 2.24 or newer, and your user in the
4347
`docker` group. Docker's own apt repository is the simplest way to get

‎embed/docs/REFERENCE.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The [hub README](../README.md) says what E2B Embed is and how to pick a
44
shape. This page holds the rest: what runs where, logs and telemetry, the
55
secrets, how images and pins are released, building templates, and the
6-
developer tooling. The 3 guides cover what differs per shape.
6+
developer tooling. The 4 guides cover what differs per shape.
77

88
## What runs where
99

@@ -149,8 +149,8 @@ commented patch line in the kustomization; the
149149
[Kubernetes guide](../kubernetes/README.md#telemetry) has both, and where the
150150
collector sits in the pod. Terraform has the `otel_collector_grpc_endpoint` and
151151
`otel_collector` variables, which the startup script writes into the
152-
instance's `.env`; the [Terraform guide](../terraform/gcp/README.md#variables)
153-
lists them.
152+
instance's `.env`; the [GCP](../terraform/gcp/README.md#variables) and
153+
[AWS](../terraform/aws/README.md#variables) guides list them.
154154

155155
## Secrets
156156

@@ -281,18 +281,20 @@ without a tunnel.
281281
| Target | What it does |
282282
|--------|--------------|
283283
| `make images` | build the 3 stack images locally under their pinned tags |
284-
| `make lint` | render the compose file and the kustomization, validate the Vector config and the Terraform module, shellcheck the scripts and the tests |
284+
| `make lint` | render the compose file and the kustomization, validate the Vector config and the 2 Terraform modules, shellcheck the scripts and the tests |
285285
| `make test` | run the bats suite in `tests/` |
286286
| `make stores-check` | the store-level integration check |
287287
| `make sync-configs` | re-inline the 3 configs into the compose file |
288288

289289
### What the targets need
290290

291291
`make lint` wants `shellcheck`, `terraform` (1.7.5 or newer) and `kubectl`,
292-
for `kubectl kustomize`. `terraform init` downloads the google and random
293-
providers, so it needs network. `make test` wants `bats` plus `kubectl`,
294-
which `tests/kubernetes.bats` renders the manifest with.
295-
`tests/terraform.bats` reads the module's files as text and needs no
292+
for `kubectl kustomize`. `terraform init` downloads the google, aws, random
293+
and time providers, once each into a shared cache, so it needs network; the
294+
aws provider alone is about 180 MB to download and about 800 MB unpacked in
295+
the cache. `make test` wants `bats` plus `kubectl`, which
296+
`tests/kubernetes.bats` renders the manifest with.
297+
`tests/terraform.bats` reads both modules' files as text and needs no
296298
terraform.
297299

298300
Both also need a working Docker daemon with the compose plugin, and `jq` on

‎embed/docs/overview.svg‎

Lines changed: 24 additions & 18 deletions
Loading

0 commit comments

Comments
 (0)