|
| 1 | +## AWS Terraform module: `dbx-proxy` |
| 2 | + |
| 3 | +This module deploys `dbx-proxy` on AWS, using an internal Network Load Balancer (NLB) and a VPC Endpoint Service (PrivateLink) for Databricks Serverless private connectivity. |
| 4 | + |
| 5 | +For common concepts (listener config, deployment modes, overall limitations), see the global module documentation in `terraform/README.md`. |
| 6 | + |
| 7 | +#### Architecture |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +This module provisions a private Network-Load-Balancer with target groups, an endpoint service for Private Link communication from Databricks serverless, and an autoscaling-group of `dbx-proxy` instances inside your VPC. |
| 12 | +In bootstrap-mode, the default subnets are created across availability-zones. The autoscaling-group automatically tries to balance instances across subnets and therefore availability-zones to achieve robustness. |
| 13 | +In proxy-only mode, it is your responsibility to configure subnets accordingly. |
| 14 | +Optional bootstrap networking creates the VPC, subnets, and NAT/IGW when not provided. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +### Quick start |
| 19 | + |
| 20 | +In your existing Terraform stack, add: |
| 21 | + |
| 22 | +```hcl |
| 23 | +module "dbx_proxy" { |
| 24 | + source = "github.com/dnks0/dbx-proxy//terraform/aws?ref=v<release>" |
| 25 | +
|
| 26 | + # AWS config |
| 27 | + region = "eu-central-1" |
| 28 | + tags = {} |
| 29 | +
|
| 30 | + # dbx-proxy config |
| 31 | + dbx_proxy_image_version = "<release>" |
| 32 | + dbx_proxy_health_port = 8080 |
| 33 | + dbx_proxy_listener = [] |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Make sure to replace `<release>` with the actual release version! |
| 38 | + |
| 39 | +Then run: |
| 40 | + |
| 41 | +```bash |
| 42 | +terraform init |
| 43 | +terraform apply |
| 44 | +``` |
| 45 | + |
| 46 | +After apply, use the output `load_balancer.vpc_endpoint_service_name` when creating Databricks private endpoint rules in your NCC. Also, add a domain of your choice as private endpoint rule on your NCC that you can use for troubleshooting. |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +### AWS-specific variables |
| 51 | + |
| 52 | +| Variable | Type | Default | Description | |
| 53 | +|---|---:|---:|---| |
| 54 | +| `region` | `string` | (required) | AWS region to deploy to. | |
| 55 | +| `vpc_id` | `string` | `null` | Existing VPC ID. Required for `proxy-only` mode. If `null`, a VPC can be bootstrapped in `bootstrap` mode. | |
| 56 | +| `subnet_ids` | `list(string)` | `[]` | Existing private subnet IDs for the NLB + ASG. Required for `proxy-only` mode. If empty, subnets can be created in `bootstrap` mode. | |
| 57 | +| `vpc_cidr` | `string` | `"10.0.0.0/16"` | VPC CIDR (only used when creating a VPC in `bootstrap`). | |
| 58 | +| `subnet_cidrs` | `list(string)` | `["10.0.1.0/24", "10.0.2.0/24"]` | Private subnet CIDRs (only used when creating subnets in `bootstrap` mode). | |
| 59 | +| `nat_subnet_cidr` | `string` | `"10.0.0.0/24"` | Public subnet CIDR for the NAT gateway (only used when creating networking in `bootstrap` mode). | |
| 60 | +| `nlb_arn` | `string` | `null` | Existing NLB ARN to attach listeners/target groups to in `proxy-only` mode. | |
| 61 | + |
| 62 | +Common variables are documented in `terraform/README.md`. |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +### Outputs |
| 67 | + |
| 68 | +- `networking`: object with |
| 69 | + - `vpc_id` |
| 70 | + - `vpc_cidr` |
| 71 | + - `subnet_ids` |
| 72 | + - `subnet_cidrs` |
| 73 | + - `nat_gateway_id` |
| 74 | + - `nat_subnet_id` |
| 75 | + - `nat_subnet_cidr` |
| 76 | + - `internet_gateway_id` |
| 77 | + |
| 78 | +- `load_balancer`: object with |
| 79 | + - `nlb_arn` |
| 80 | + - `nlb_dns_name` |
| 81 | + - `nlb_target_group_arns` |
| 82 | + - `nlb_security_group_ids` |
| 83 | + - `vpc_endpoint_service_arn` |
| 84 | + - `vpc_endpoint_service_name` |
| 85 | + |
| 86 | +- `proxy`: object with |
| 87 | + - `iam_role_name` |
| 88 | + - `iam_role_arn` |
| 89 | + - `instance_profile_name` |
| 90 | + - `instance_profile_arn` |
| 91 | + - `security_group_id` |
| 92 | + - `autoscaling_group_name` |
| 93 | + - `launch_template_name` |
| 94 | + - `dbx_proxy_cfg` |
| 95 | + |
| 96 | +--- |
| 97 | +### Notes for AWS users |
| 98 | + |
| 99 | +- Multi availability-zone resilience can be achieved by providing subnets across multiple availability-zones. By default, the autoscaling-group tries to spread dbx-proxy instances across subnets eavenly. In `proxy-only` mode, you are responsible to configure subnets accordingly. In `bootstrap` mode, default subnets are created across multiple availaiblity-zones in the selected region. |
0 commit comments