# Setting up API Gateway with Private Link Enabled (to access Serverless Lambda inside VPC)

**URL:** <https://forum.serverless.com/t/setting-up-api-gateway-with-private-link-enabled-to-access-serverless-lambda-inside-vpc/4395>\
**Category:** Serverless Framework\
**Created:** [May 1, 2018, 4:03pm UTC](https://forum.serverless.com/t/setting-up-api-gateway-with-private-link-enabled-to-access-serverless-lambda-inside-vpc/4395 "2018-05-01T16:03:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimoes](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@dimoes](https://forum.serverless.com/u/dimoes)\
**Post date:** [May 1, 2018, 4:03pm UTC](https://forum.serverless.com/t/setting-up-api-gateway-with-private-link-enabled-to-access-serverless-lambda-inside-vpc/4395/1 "2018-05-01T16:03:38Z")

</div>

As described in the topic name, does anyone know how I can enable (via yaml) an AWS Private Linked API Gateway for a server less Lambda?

---

<div class="post-metadata">

**Author:** ![Patchoulin](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Patchoulin](https://forum.serverless.com/u/Patchoulin)\
**Post date:** [July 29, 2019, 2:05pm UTC](https://forum.serverless.com/t/setting-up-api-gateway-with-private-link-enabled-to-access-serverless-lambda-inside-vpc/4395/2 "2019-07-29T14:05:16Z")

</div>

Did you find a solution ?

[UPDATE]  
I found the following method :

1. create manually the VPC, private subnet;
2. create manually a VPC endpoint (his security group must allow incoming HTTPS trafic);
3. create manually the security group for the private subnet (that must allow incoming HTTPS trafic from the created VPC endpoint);
4. add the following configuration to your serverless.yml of your private microservice :

> ```
> vpc:
> securityGroupIds:
> - sg-0e2fbbf293xxxxxxx
> subnetIds:
> - subnet-0c1f109b92xxxxxxx
> endpointType: private
> resourcePolicy:
> - Effect: Allow
> Principal: '*'
> Action: execute-api:Invoke
> Resource: '*'
> Condition:
> StringEquals:
> 'aws:sourceVpce': vpce-0c3f05af1e8xxxxxx
> 
> ```

1. sls deploy 🙂

Hope it can help.
