Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS - Cannot find a Cloudfront stack

I'm facing a pretty weird problem using AWS CLI. I created a new IAM user from my main profile and I gave this user AdministratorAccess in order to allow this user to create AWS resources using a CloudFormation script.

I just created a new stack containing a VPC resource. The stack should have been created in eu-west-2 since I got the following message:

{
    "StackId": "arn:aws:cloudformation:eu-west-2:350027292717:stack/emajarstack/a3b07fd0-8d1e-11ea-9ac5-060e4e394d84"
}

If I log in with my main AWS profile I cannot see any stack created in the eu-west-2 region. I even tried to run a couple of CLI commands to list or describe my stacks but apparently no stack has been created:

$ aws cloudformation list-stacks
{
    "StackSummaries": []
}

$ aws cloudformation describe-stacks --stack-name emajarstack
An error occurred (ValidationError) when calling the DescribeStacks operation: Stack with id emajarstack does not exist

Fun fact is that I cannot create the same stack because I get the following message:

An error occurred (AlreadyExistsException) when calling the CreateStack operation: Stack [emajarstack] already exists

Questions are:

  • do you know how can I find my stack or if I'm doing something wrong?
  • is there a way to search a stack by id?
like image 403
Ema.jar Avatar asked Jul 24 '26 16:07

Ema.jar


1 Answers

This message does NOT guarantee the stack will be created successfully:

"StackId": "arn:aws:cloudformation:eu-west-2:350027292717:stack/emajarstack/a3b07fd0-8d1e-11ea-9ac5-060e4e394d84"

Two possibilities here:

1 - 99% sure your stack failed creation because of some issues with the template or other (e.g. limits, dependencies) and that's why it's not showing up, check in the console for more details. It might be in roll_back complete state, so if you can't look at the console, use this flag:

aws cloudformation list-stacks --stack-status-filter ROLLBACK_COMPLETE

2 - Specify the correct region with your list command as your CLI will be looking in the default region which could be different from the one your stack is in.

Edit: also, run aws sts get-caller-identity to ensure you are using the right user with enough permissions.

like image 177
Ali Avatar answered Jul 27 '26 13:07

Ali