# Deploy single function to a VPC

**URL:** https://forum.serverless.com/t/deploy-single-function-to-a-vpc/7510
**Category:** Serverless Framework
**Tags:** aws
**Created:** [February 26, 2019, 12:27pm UTC](https://forum.serverless.com/t/deploy-single-function-to-a-vpc/7510 "2019-02-26T12:27:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![khinester](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/khinester/32/315_2.png) [@khinester](https://forum.serverless.com/u/khinester)
#### Post date: [February 26, 2019, 12:27pm UTC](https://forum.serverless.com/t/deploy-single-function-to-a-vpc/7510/1 "2019-02-26T12:27:50Z")

</div>

hello, i have a project where one of the functions needs to communicate to an EC2 instance in a VPC, what is the correct way to enable this?

how do i set it up just for one of the functions, instead of being global?

would i have to create a separate resource, such as

```auto
Resources:
  Func1:
    Type: AWS::Serverless::Function
    Properties:
      Policies:
        - arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole
      CodeUri: src/handlers/sample-func1
      VpcConfig:
        SecurityGroupIds:
          - sg-808e4df9

```

within my serverless.yml?

this function would also need access to `S3`, in this case i would need NAT on the VPC for the function to be able to connect to `S3` or is there a different way to approach this?

basically my use case is that i have an `S3` bucket that triggers an event on an upload, this then has couple of steps and on one of the steps i have a function that needs to send files to an FTP ec2 instance that is in the VPC so that these files can be consumed by a legacy system.

any advice is much appreciated
