Assigns an alias to an existing stack. An alias is an alternative name for a stack that can be used in place of the stack name in any CloudFormation API call that accepts the StackName parameter. This enables you to effectively rename a stack without recreating it.
After setting an alias, both the original stack name and the alias resolve to the same stack. Setting an alias does not change the stack's ARN, physical resource IDs, or any deployed resources.
Each stack can have at most one alias. To change a stack's alias, first remove the existing alias using RemoveAlias, then set a new one.
Parameters:
-
stack_name
(Optional[StackName], default:
None
)
–
The name or unique stack ID of the stack to assign an alias to.
-
alias_name
(Optional[AliasName], default:
None
)
–
The alias to assign to the stack. The alias can then be used in place of the stack name in any API call that accepts StackName.
The name must be unique within the same account and Region. It cannot match an existing stack name or another active alias.
An alias name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters.
Raises:
Examples:
Example – Set an alias for a stack
The following example assigns the alias MyAlias to the stack MyStack:
>>> client.set_alias(stack_name='MyStack', alias_name='MyAlias')
Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
| def set_alias(
self,
*,
config_overrides: Optional[CloudFormationClientConfig] = None,
stack_name: Optional["capo_cloudformation.types.stack_name.StackName"] = None,
alias_name: Optional["capo_cloudformation.types.alias_name.AliasName"] = None,
) -> None:
"""<p>Assigns an alias to an existing stack. An alias is an alternative name for a stack that can be used in place of the stack name in any CloudFormation API call that accepts the <code>StackName</code> parameter. This enables you to effectively rename a stack without recreating it.</p> <p>After setting an alias, both the original stack name and the alias resolve to the same stack. Setting an alias does not change the stack's ARN, physical resource IDs, or any deployed resources.</p> <note> <p>Each stack can have at most one alias. To change a stack's alias, first remove the existing alias using <a>RemoveAlias</a>, then set a new one.</p> </note>
Args:
stack_name: <p>The name or unique stack ID of the stack to assign an alias to.</p>
alias_name: <p>The alias to assign to the stack. The alias can then be used in place of the stack name in any API call that accepts <code>StackName</code>.</p> <p>The name must be unique within the same account and Region. It cannot match an existing stack name or another active alias.</p> <note> <p>An alias name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters.</p> </note>
Raises:
capo_cloudformation.errors.already_exists_exception.AlreadyExistsException: <p>The resource with the name requested already exists.</p>
capo_cloudformation.errors.limit_exceeded_exception.LimitExceededException: <p>The quota for the resource has already been reached.</p> <p>For information about resource and stack limitations, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html">CloudFormation quotas</a> in the <i>CloudFormation User Guide</i>.</p>
capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Example – Set an alias for a stack
The following example assigns the alias MyAlias to the stack MyStack:
>>> client.set_alias(stack_name='MyStack', alias_name='MyAlias')
"""
def _handler(
req: "OperationRequest[capo_cloudformation.types.set_alias_input.SetAliasInput]",
) -> OperationResponse[None]:
import capo_cloudformation._operations.cloud_formation.set_alias
output, http_response = (
capo_cloudformation._operations.cloud_formation.set_alias.set_alias(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SetAlias")
)
input_: capo_cloudformation.types.set_alias_input.SetAliasInput = {}
if stack_name is not None:
input_["stack_name"] = stack_name
if alias_name is not None:
input_["alias_name"] = alias_name
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|