Provisioning our stack
In Chapter 1, Working with CloudFormation, we created our stack with a simple command:
$ aws cloudformation create-stack --stack-name ... --template-body file://...
This command invokes a CloudFormation API, CreateStack
. CloudFormation’s API receives the template and parameters in the request body and starts creating the stack.
When we want to update our stack (for example, make changes to the existing resources or add new ones), we invoke another API, UpdateStack
:
$ aws cloudformation update-stack --stack-name ... --template-body file://...
In both cases, the AWS CLI will invoke the ListStacks
API method to check whether the stack exists or not.
If the stack exists during the creation operation, you will receive an error:
An error occurred (AlreadyExistsException) when calling the CreateStack operation: Stack [...] already exists
If you try to update a stack that does not exist, you will receive another error:
An error occurred...