Error : AWS issue with security group

Hello all,

I’m discovering serverless framework, and, based on this tutorial, I was able to test locally my application without any issue, but when it comes to the “simplest” part, deploying with configuring the serverless.yml file and deploying, I have the following error :

Serverless Error ---------------------------------------
An error occurred: LoginLambdaFunction - Error occurred while DescribeSecurityGroups. EC2 Error Code: InvalidGroup.NotFound. EC2 Error Message: The security group ‘sg-3d5f0e51’ does not exist (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 83b0c23b-ddff-4a63-ab12-0c9bbd21f06e).

Here is my serverless.yml (correctly indented in reality)

service: authentication-api
custom:
secrets: {file(secrets.json)} provider: name: aws runtime: nodejs12.x timeout: 30 stage: {self:custom.secrets.NODE_ENV}
region: eu-west-3
environment:
NODE_ENV: {self:custom.secrets.NODE_ENV} DB_NAME: {self:custom.secrets.DB_NAME}
DB_USER: {self:custom.secrets.DB_USER} DB_PASSWORD: {self:custom.secrets.DB_PASSWORD}
DB_HOST: {self:custom.secrets.DB_HOST} DB_PORT: {self:custom.secrets.DB_PORT}
vpc:
securityGroupIds:
- {self:custom.secrets.SECURITY_GROUP_ID} subnetIds: - {self:custom.secrets.SUBNET1_ID}
- {self:custom.secrets.SUBNET2_ID} - {self:custom.secrets.SUBNET3_ID}
functions:
signup:
handler: handler.signup
events:
- http:
path: signup
method: post
cors: true
login:
handler: handler.login
events:
- http:
path: login
method: post
cors: true
auth:
handler: handler.auth
events:
- http:
path: auth
method: post
cors: true
plugins:

  • serverless-offline

After many readings, I’ve checked that I got the right region, I’ve check if I have misspelled a key in the yaml file and I’ve created a new vpc in AWS, I was using the default one on the format : sg-xxxxxx … Always the same error.
Does anyone have a clue?

Thank you.