serverless/serverless · error · ServerlessError
AWS_VPC_NAT_GATEWAY_CREATE_FAILED
AWS_VPC_NAT_GATEWAY_CREATE_FAILED
Error message
Failed to create NAT gateways
What it means
Error "Failed to create NAT gateways" thrown in serverless/serverless.
Source
Thrown at packages/engine/src/lib/aws/vpc.js:623
{
Key: 'Name',
Value: `${namespace}-nat-gateway`,
},
{
Key: 'Namespace',
Value: namespace,
},
],
},
],
}),
)
if (
createNatGatewayResponse.$metadata.httpStatusCode !== 200 ||
!createNatGatewayResponse.NatGateway?.NatGatewayId
) {
throw new ServerlessError(
'Failed to create NAT gateways',
'AWS_VPC_NAT_GATEWAY_CREATE_FAILED',
)
}
logger.debug(`Created NAT gateway for namespace ${namespace}`)
await setTimeout(10000)
return createNatGatewayResponse.NatGateway.NatGatewayId
}
/**
* Create an elastic IP for the given namespace.
* @param {string} namespace
* @returns {Promise<string>} The elastic IP allocation ID
*/
async _createElasticIp(namespace) {
const describeAddressesResponse = await this.client.send(
new DescribeAddressesCommand({View on GitHub (pinned to b9d7ea51c8)
Solutions
- Verify the subnets exist and are in an available state, then retry the deployment.
- Ensure your IAM permissions include ec2:CreateNatGateway and that you have available elastic IPs.
When it happens
Trigger: Thrown at packages/engine/src/lib/aws/vpc.js:623 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of serverless/serverless@b9d7ea51c8 (2026-08-13).
Data as JSON: /api/errors/2b7499012997ee43.
Report an issue: GitHub.