# Using the Fleet Terraform module with an existing VPC
The Fleet Terraform module is the recommended way to quickly get Fleet up and running in AWS. However, some organizations may already have an existing VPC that they would like leverage to deploy Fleet. This article shows what that would look like, leveraging the module at the bring-your-own VPC (BYO-VPC) level.
Starting at the BYO-VPC level has all of the same initial [requirements](https://fleetdm.com/docs/deploy/deploy-on-aws-with-terraform#bring-your-own-nothing) as the root (BYO-Nothing) Terraform module. We will need to include these in our example here as well for visibility:
Additionally, we will have to have a VPC created. The [Terraform AWS VPC module](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/3.18.1) is one of the easiest ways to get all the necessary pieces quickly, so we'll use this in the example.
Since it is likely that an organization wanting to leverage BYO-VPC did not use the above module, below is the resource info required from the existing VPC and the corresponding resource name from the module used below:
- The VPC ID: `module.vpc.vpc_id`
- A private subnet for Fleet ECS containers: `module.vpc.private_subnets`
- A private subnet for RDS: `module.vpc.database_subnets`
- A private subnet for Redis: `module.vpc.elasticache_subnets`
- An elasticache subnet group for Redis (optional): `module.vpc.elasticache_subnet_group_name`
- A public subnet for the load balancer: `module.vpc.public_subnets`
While Fleet recommends that each private subnet be unique as a best practice, it is technically possible to place Fleet/ECS, RDS, and Redis all in the same private subnet. Just provide the same subnet ID in each of the respective locations below. If an elasticache subnet group is not already created for your VPC, it can be omitted and will be automatically generated by the downstream module.
Next, we'll want to configure the BYO-VPC module with at least a minimal configuration. While it is not necessary to specify a Fleet image version, it is strongly recommended. This way an organization is fully in control of the version of Fleet deployed regardless of updates to the Terraform module or Fleet releases. Below shows a minimal configuration that includes the Fleet image:
Defining the `fleet_image` as a local allows it to be reused by other add-on modules that will require the running fleet version to be specified such as the external vulnerability processing add-on. For Fleet Premium users, the license can be included in an AWS Secretsmanager Secret and added in as the commented-out example above shows.
Similar to using the root module, it is recommended to at least include the migration add-on module to make it easier to upgrade Fleet in the future and to get the initial migrations in place. This adds the following:
All add-ons at the time of this writing are compatible with the BYO-VPC module. If examples reference resources, the BYO-Nothing/root module in the format of `module.main.byo-vpc...` simply omit `.main` from them so they look like the references above in the migrations example.
Since the VPC must exist before the BYO-VPC module can be applied and our BYO-VPC module has to create the the other resources before the migrations can be run, we will need to use targeted applies as below:
```bash
terraform init
terraform apply -target=module.vpc
terraform apply -target=module.byo-vpc
terraform apply
```
The BYO-VPC configuration can be fully customized similar to the [Terraform root module](https://github.com/fleetdm/fleet/tree/main/terraform). See the [BYO-VPC reference](https://github.com/fleetdm/fleet/tree/main/terraform/byo-vpc) for a full list of variables.