As it is mentionned in the serverless doc, the vpc configuration of a function should inherit from the provider vpc configuration.
Or in my case, if I mention the vpc config only for the provider, the function doesn’t inherit this vpc config…
Am I missing something ?
Here is an extract of my basic serverless.yml config :
provider:
name: aws
runtime: nodejs4.3
stage: dev
region: eu-central-1
memorySize: 128
timeout: 5
deploymentBucket: XXXXXXX
versionFunctions: false
vpc:
securityGroupsIds:
- sg-XXXXXX
subnetIds:
- subnet-XXXXXXX
- subnet-XXXXX
iamRoleStatements:
- Effect: "Allow"
Action:
- s3:PutObject
- s3:GetObject
Resource: "arn:aws:s3:::${self:custom.aws.s3.bucket.name}/${self:custom.aws.s3.bucket.folder.refdata}/*"
- Effect: "Allow"
Action:
- ec2:CreateNetworkInterface
- ec2:DescribeNetworkInterfaces
- ec2:DetachNetworkInterface
- ec2:DeleteNetworkInterface
Resource: "*"
functions:
init:
handler: handler-init.launch
description:XXXXXXXX
# vpc:
# securityGroupsIds:
# - sg-ea1afe81
# subnetIds:
# - subnet-35cb965c
# - subnet-f99aea82
As soon as I decomment the vpc section of the function, all works fine…
Thanks !
Stephane