AWS SAM deployed Error under hello world template
Asked Answered
C

4

14

I'm currently working on AWS serverless lambda function deployment and try to distribute and test with AWS SAM. However, when I followed the AWS SAM hello world template tutorial on official website, I can't really deploy my code to AWS.

I've already

  1. Assigned a working IAM account
  2. Install every package we need for AWS SAM (brew, aws-sam-cli...etc)
  3. Set up AWS configuration
  4. Using a function template provided by AWS

Yet, I got error message

Error: Stack aws-sam-cli-managed-default is missing Tags and/or Outputs information and therefore not in a healthy state (Current state:aws-sam-cli-managed-default). Failing as the stack was likely not created by the AWS SAM CLI

Correggio answered 24/12, 2020 at 10:21 Comment(1)
Please edit your question and add the code your templateWhistle
A
18

Took me a minute to figure out too.

Open up CloudFormation in AWS and delete the aws-sam-cli-managed-default stack then try to redeploy.

Every time your deploy fails you'll likely have to do this again.

Anthurium answered 3/8, 2021 at 20:4 Comment(1)
Worked for me! just make sure you are in the right region. Thanks.Seem
R
2

It's aws credentials error - because you not configure it right or not config at all.

If you didn't have aws cli installed on your computer, find aws cli installer for your filesystem, for mac it's https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html.

Go to https://console.aws.amazon.com/iam and create new user with AdministratorAccess permission and get aws_access_key_id and aws_secret_access_key.

Go to your terminal and type aws configure.

Enter your credentials.

Try to run sum build && sum deploy --guided

Now it's need to work.

Raffaello answered 10/4, 2021 at 22:2 Comment(1)
This was the problem for me. My CLI access keys had expired.Mazy
E
1

If it helps, I got the same exact problem.

The error log was

Error: Stack aws-sam-cli-managed-default is missing Tags and/or Outputs information and therefore not in a healthy state (Current state:ROLLBACK_COMPLETE). Failing as the stack was likely not created by the AWS SAM CLI

So, the first thing I did was go to CloudFormation and check out the aws-sam-cli-managed-default stack.

So, under the Event tab you will see much more logging and i notice my case was.

You have attempted to create more buckets than allowed (Service: Amazon S3; Status Code: 400; Error Code: TooManyBuckets; Request ID: KEATRFFEXEP4YK; S3 Extended Request ID: B4glj4YCkgCyvEsG9QVfyGlFmQiQazNhM89nAkUB+B7iuWSbLaO6ZTLs+qDTBg9xxQ=; Proxy: null)

Which is clearly says I just surpassed the limit for the number of AWS S3 bucket you can create for a single account which is 150 buckets.

You can either mention the s3 bucket in the configuration to reuse other (use .samconfig and refer to the documentation) or you raise a case with AWS to increase your limit for the number S3 bucket you can have in a single account.

In my case it was on development account, so I fixed by deleting unused bucket instead of raising a case with AWS because on our prod account it is already increased (may be unlimited number of s3).

Hope it helps.

Eyelash answered 24/12, 2020 at 10:21 Comment(0)
A
1

Like @Eli Meiler says, it may well be a credential issue. If you need to see more details here try

$ aws cloudformation describe-change-set --change-set-name InitialCreation --stack-name aws-sam-cli-managed-default

...FAILED  User: arn:aws:iam::123:user/<human user> is not authorized to perform:
cloudformation:CreateChangeSet
on resource: arn:aws:cloudformation:eu-central-1:aws:transform/Serverless-2016-10-31
with an explicit deny in an identity-based policy

EDIT

Even though I had full permissions in that AWS account, what I was not aware was that MFA / 2-factor auth is kinda troublesome here.

The advice that worked for me was this github comment to

  • generate an sts token
  • set the env vars and
  • then try sam deploy --guided again
$ aws sts get-session-token --serial-number arn:aws:iam::<account_id>:mfa/<human.user>  --duration-seconds 15000 --token-code 123456
Amplifier answered 26/8, 2022 at 9:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.