Stack with id does not exist? Stack definitely exists

aws

#1

I’ve been working on a serverless project since the beginning of last week - since the weekend (and a system reboot) my serverless project is now giving me Stack with id [stack-name] does not exist for just about all operations. The stack ID in question is an existing CloudFormation stack that definitely exists in the target account.

I’ve googled high & low for an answer to this with no success.

Occasionally in my attempts to get this working again I’ve been given the AWS provider credentials not found. error but I don’t know if that’s because I had screwy config at the time.

I’m using AWS with a primary account for which I have access keys with a secondary account that has a role which I am assuming for the deployment.

Normal AWS CLI functionality works in that I can aws --profile ${SECOND_ACCOUNT} cloudformation describe-stacks --stack-name ${STACK_NAME} and see the normal output.

Serverless Version: 1.20.1
Node Version: 6.11.0
OS: Bash (Ubuntu) on Windows

As said - this setup was working last week, though it took a bit of convincing, turns out I had a typo in my .aws/config file which I fixed at the time. I don’t know if during the process of trying to fix this I exported some environment variables that fixed the issue.

Things I’ve tried:

  1. Exporting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
  2. Exporting an AWS_PROFILE environment variable
  3. Setting credentials using serverless config credentials

The command I’m running is serverless info -s dev --aws-profile ${SECOND_ACCOUNT}.

What am I missing? 5 internets to the person who can spot my fail.

Edit: Command syntax


#2

Updated to 1.21.0 - still not working.


#3

Have you changed regions?

CloudFormation is region specific so if you have moved from one region to another while you were trying different credential methods, will account for the issue.

You can check what region the stack is in, using the console, then set the region explicitly using -r (edit: as a test, then set it permanently, probably using ~/aws/config).


#4

My default region is eu-west-1 and hasn’t changed.

I have the region configured in my ~/.aws/config file but I also tried specifying it on the CLI with the --region option.

I’ve managed to get it to work using aws sts assume-role and proving the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN variables on the CLI but this is not exactly ideal.


#5

Someone else raised the same problem and ended up having a bash script that does the trick (save anyone writing their own).

It’d be nice to see this in Serverless as it’s in similar tools like Sceptre using the iam_role configuration option.