Provisioning our stack
In the first chapter, 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 the creation of 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, AWS CLI will invoke the ListStacks
API method in order 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 (ValidationError...