stratospheric-dev / stratospheric

All you need to know to get your Spring Boot application into production with AWS 🍃
https://stratospheric.dev
Apache License 2.0
262 stars 187 forks source link

Getting an error while creating a stack from the template - registry.yml #204

Closed basilk27 closed 1 year ago

basilk27 commented 1 year ago

What's going wrong and not working?

The Repo: https://github.com/basilk27/Todo-using-template-file The registry.yml is in /cloudformation folder.

aws cloudformation deploy \  ✔  stratospheric us-east-1  --stack-name=hello-world-docker-repository \ --template-file registry.yml \ --parameter-overrides RegistryName=hello-world-app \ --profile stratospheric

Waiting for changeset to be created.. Waiting for stack create/update to complete

Failed to create/update the stack. Run the following command to fetch the list of events leading up to the failure

Getting the following error:

2023-05-31 22:15:04 UTC-0400 hello-world-docker-repository
ROLLBACK_COMPLETE

2023-05-31 22:15:03 UTC-0400 Registry
DELETE_COMPLETE

2023-05-31 22:15:00 UTC-0400 hello-world-docker-repository
ROLLBACK_IN_PROGRESS The following resource(s) failed to create: [Registry]. Rollback requested by user. 2023-05-31 22:14:59 UTC-0400 Registry
CREATE_FAILED Resource handler returned message: "Resource of type 'AWS::ECR::Repository' with identifier 'hello-world-app' already exists." (RequestToken: ae022db4-58c1-42e0-ec16-625e45af53e7, HandlerErrorCode: AlreadyExists)

Expected outcome

Expecting the same output as in the video class 1.04 - Getting Started with CloudFormation.

Thanks

rieckpil commented 1 year ago

Hey @basilk27, the ECR name has to be unique for this region.

The error states

Resource handler returned message: "Resource of type 'AWS::ECR::Repository' with identifier 'hello-world-app' already exists.

Try to change the identifier of the registry to something unique in the template and try it again, e.g. hello-world-app-basilk27

basilk27 commented 1 year ago

@rieckpil The cause of the problem was that I had to clean up the work that had been done in step - 1.03 - Deploy a Docker Image to Amazon ECR before running step 1.04 - Getting Started with CloudFormation.

Thanks

basilk27 commented 1 year ago

Do not forget to delete the repository created in 1.03 - Deploy a Docker Image to Amazon ECR before running step 1.04 - Getting Started with CloudFormation.