serverless: EC2 Error Code: InvalidGroup.NotFound. The security group does not exist.
This is a Bug Report
Description
- What went wrong?
serverless deploy failed with an error, for a project using a pre-existing VPC
- What did you expect should have happened?
serverless deploy should have completed without error
- What was the config you used?
My serverless.yml defines provider.vpc.securityGroupIds to a single security group, and provider.vpc.subnetIds to multiple security groups
- What stacktrace or error message from your provider did you see?
Serverless: Packaging service… Serverless: Uploading CloudFormation file to S3… Serverless: Uploading service .zip file to S3 (23.9 MB)… Serverless: Updating Stack… Serverless: Checking Stack update progress… …Serverless: Deployment failed!
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: RedactedLambdaFunction - Error occurred while DescribeSecurityGroups. EC2 Error Code: InvalidGroup.NotFound. EC2 Error Message: The security group 'sg-redacted' does not exist.Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues
Your Environment Information ----------------------------- OS: darwin Node Version: 6.9.2 Serverless Version: 1.4.0
Similar or dependent issues:
- n/a
Additional Data
aws ec2 describe-security-groups --group-ids sg-redacted (executed from the same terminal session with the same environment variables as serverless deploy) confirms that the security group exists
aws ec2 describe-subnets --subnet-ids subnet-redacted subnet-redacted confirms that the subnets exist
Comparing the output from these commands confirms that they all belong to the same VPC
- Serverless Framework Version you’re using: 1.4.0
- Operating System: macOS Sierra 10.12.3 Beta (16D12b)
- Stack Trace: see above
- Provider Error messages: see above
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 6
- Comments: 22 (6 by maintainers)
Thank you. You solved the problem! In going through my config file to get a minimal example I realized I was using the wrong profile setting. That would do it.
Thanks again and sorry for the noob error. 😦
I also faced the similar issue, and I was using a profile that is not my default aws profile.
Description
What went wrong?
serverless deploy --aws-profile assumed_rolefailed with an error, for a project using a pre-existing VPC.What did you expect should have happened?
serverless deploy --aws-profile assumed_roleshould have completed without error.What was the config you used? My serverless.yml defines provider.vpc.securityGroupIds to a single security group, and provider.vpc.subnetIds to three security groups.
What stacktrace or error message from your provider did you see?
Additional Data
I have also tried these two commands to confirm both security group and subnets exist.
aws ec2 describe-security-groups --group-ids <sg-id> --profile assumed_roleaws ec2 describe-subnets --profile assumed_role --subnet-ids subnet-redacted subnet-redacted~/.aws/configand~/.aws/credentialsare set correctly with the profile name and credentials.Ok - not sure if this related to what you said @jokeyrhyme but I’ve got it working now.
Serverless doesn’t seem to use my default region (where the VPC is) as listed in
~/.aws/configso was trying to deploy to the Serverless default regionus-east-1.Would be awesome if Serverless would honour this file or maybe make it mandatory to provide a
regionin your config? Just some ideas.