> For the complete documentation index, see [llms.txt](https://docs.stackmate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackmate.io/how-to/use-your-own-vpc-on-aws.md).

# Use your own VPC on AWS

Stackmate deploys a VPC for every environment it handles. For example, if you have two environments, `production` and `staging`, you'll get two different VPCs when finished deploying.

By default, AWS has a limit of 5 VPCs per account, which means that you should either be re-using a VPC you've already used elsewhere, or reach out to the AWS support to have them increase your VPC quota.

In our example, we'll create and use a VPC that we'll add to our stackmate configuration.

* First, let's create a VPC on AWS: We can create the VPC using the Console by following [this document](https://docs.aws.amazon.com/vpc/latest/userguide/create-vpc.html#create-vpc-only), or use the AWS CLI by following [this one](https://docs.aws.amazon.com/vpc/latest/userguide/create-vpc.html#create-vpc-cli) instead.&#x20;
* Next, we need to grab the VPC ID and the Root IP used to create the CIDR blocks on the VPC
* In our example, we assume that the VPC ID is `vpc-1234567` and the CIDR block will be `19.0.0.0/24` which means that our root IP address is `19.0.0.0`
* We need to add a `provider` service on our configuration as follows:

{% code title=".stackmate/config.yml" %}

```yaml
---
state:
  bucket: ...
  lockTable: ...
environments:
  production:
    aws:
      type: provider
      vpcId: "vpc-1234567"
      rootIp: "19.0.0.0"
    app:
      type: application
      # ... the rest of the configuration here ...
```

{% endcode %}

What stackmate will do next then, is to import the vpc specified, and use this as the reference VPC for your AWS services


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stackmate.io/how-to/use-your-own-vpc-on-aws.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
