or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

change-sets.mdclient-configuration.mddrift-detection.mdgenerated-templates.mdindex.mdpagination-waiters.mdresource-type-registry.mdstack-information.mdstack-management.mdstack-refactoring.mdstack-sets.mdtemplate-operations.md
tile.json

stack-management.mddocs/

Stack Management

Core CloudFormation stack operations for creating, updating, deleting, and monitoring infrastructure deployments.

Capabilities

Create Stack

Creates a new CloudFormation stack from a template.

/**
 * Creates a CloudFormation stack as specified in the template
 * Stack creation starts after successful call completion
 */
class CreateStackCommand {
  constructor(input: CreateStackCommandInput);
}

interface CreateStackCommandInput {
  /** Name of the stack (unique within region) */
  StackName: string;
  
  /** CloudFormation template as JSON/YAML string */
  TemplateBody?: string;
  
  /** S3 URL containing the CloudFormation template */
  TemplateURL?: string;
  
  /** Stack parameter values */
  Parameters?: Parameter[];
  
  /** Prevent rollback on stack creation failure */
  DisableRollback?: boolean;
  
  /** Rollback configuration settings */
  RollbackConfiguration?: RollbackConfiguration;
  
  /** Stack timeout in minutes */
  TimeoutInMinutes?: number;
  
  /** SNS topic ARNs for stack event notifications */
  NotificationARNs?: string[];
  
  /** IAM capabilities required by the template */
  Capabilities?: Capability[];
  
  /** Resource types that can be created */
  ResourceTypes?: string[];
  
  /** IAM service role ARN for stack operations */
  RoleARN?: string;
  
  /** Callback URL for stack progress updates */
  OnFailure?: OnFailure;
  
  /** Stack policy document */
  StackPolicyBody?: string;
  
  /** S3 URL containing stack policy */
  StackPolicyURL?: string;
  
  /** Resource tags */
  Tags?: Tag[];
  
  /** Unique identifier to ensure idempotency */
  ClientRequestToken?: string;
  
  /** Enable termination protection */
  EnableTerminationProtection?: boolean;
}

interface CreateStackCommandOutput {
  /** Unique stack identifier */
  StackId?: string;
}

Usage Examples:

import { CloudFormationClient, CreateStackCommand } from "@aws-sdk/client-cloudformation";

const client = new CloudFormationClient({ region: "us-east-1" });

// Create stack with inline template
const command = new CreateStackCommand({
  StackName: "my-s3-stack",
  TemplateBody: JSON.stringify({
    AWSTemplateFormatVersion: "2010-09-09",
    Resources: {
      MyBucket: {
        Type: "AWS::S3::Bucket",
        Properties: {
          BucketName: "my-unique-bucket-name"
        }
      }
    }
  }),
  Tags: [
    { Key: "Environment", Value: "Development" },
    { Key: "Project", Value: "MyApp" }
  ]
});

const result = await client.send(command);
console.log("Stack ID:", result.StackId);

// Create stack with parameters and capabilities
const parameterizedCommand = new CreateStackCommand({
  StackName: "my-iam-stack", 
  TemplateURL: "https://my-bucket.s3.amazonaws.com/iam-template.yaml",
  Parameters: [
    { ParameterKey: "RoleName", ParameterValue: "MyCustomRole" },
    { ParameterKey: "Environment", ParameterValue: "prod" }
  ],
  Capabilities: ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"],
  TimeoutInMinutes: 30
});

Update Stack

Updates an existing CloudFormation stack with a new template or parameter values.

/**
 * Updates a CloudFormation stack with new template or parameters
 * No-op if no changes are detected
 */
class UpdateStackCommand {
  constructor(input: UpdateStackCommandInput);
}

interface UpdateStackCommandInput {
  /** Name or ARN of the stack to update */
  StackName: string;
  
  /** Updated CloudFormation template */
  TemplateBody?: string;
  
  /** S3 URL containing updated template */
  TemplateURL?: string;
  
  /** Use previous template if no new template provided */
  UsePreviousTemplate?: boolean;
  
  /** Stack policy during update */
  StackPolicyDuringUpdateBody?: string;
  
  /** S3 URL containing update policy */
  StackPolicyDuringUpdateURL?: string;
  
  /** Updated parameter values */
  Parameters?: Parameter[];
  
  /** IAM capabilities required by updated template */
  Capabilities?: Capability[];
  
  /** Resource types that can be updated */
  ResourceTypes?: string[];
  
  /** IAM service role for update operations */
  RoleARN?: string;
  
  /** Rollback configuration for update */
  RollbackConfiguration?: RollbackConfiguration;
  
  /** Updated stack policy */
  StackPolicyBody?: string;
  
  /** S3 URL containing updated stack policy */
  StackPolicyURL?: string;
  
  /** Updated notification topics */
  NotificationARNs?: string[];
  
  /** Updated resource tags */
  Tags?: Tag[];
  
  /** Disable rollback on update failure */
  DisableRollback?: boolean;
  
  /** Unique identifier for idempotency */
  ClientRequestToken?: string;
}

interface UpdateStackCommandOutput {
  /** Unique stack identifier */
  StackId?: string;
}

Delete Stack

Deletes an existing CloudFormation stack and all its resources.

/**
 * Deletes a CloudFormation stack and all resources
 * Resources are deleted in dependency order
 */
class DeleteStackCommand {
  constructor(input: DeleteStackCommandInput);
}

interface DeleteStackCommandInput {
  /** Name or ARN of the stack to delete */
  StackName: string;
  
  /** Resources to retain during deletion */
  RetainResources?: string[];
  
  /** IAM service role for deletion operations */
  RoleARN?: string;
  
  /** Unique identifier for idempotency */
  ClientRequestToken?: string;
}

Usage Examples:

// Update stack with new parameters
const updateCommand = new UpdateStackCommand({
  StackName: "my-s3-stack",
  UsePreviousTemplate: true,
  Parameters: [
    { ParameterKey: "BucketName", ParameterValue: "my-updated-bucket-name" }
  ]
});

await client.send(updateCommand);

// Delete stack
const deleteCommand = new DeleteStackCommand({
  StackName: "my-s3-stack"
});

await client.send(deleteCommand);

// Delete stack but retain specific resources
const retainCommand = new DeleteStackCommand({
  StackName: "my-stack-with-data",
  RetainResources: ["MyDatabase", "MyS3Bucket"]
});

await client.send(retainCommand);

Cancel Stack Update

Cancels an in-progress stack update operation.

/**
 * Cancels a stack update that is in progress
 * Stack returns to previous working state
 */
class CancelUpdateStackCommand {
  constructor(input: CancelUpdateStackCommandInput);
}

interface CancelUpdateStackCommandInput {
  /** Name or ARN of the stack with update to cancel */
  StackName: string;
  
  /** Unique identifier for idempotency */
  ClientRequestToken?: string;
}

Continue Update Rollback

Continues rolling back a stack that is in UPDATE_ROLLBACK_FAILED state.

/**
 * Continues rolling back a stack in UPDATE_ROLLBACK_FAILED state
 * Allows specifying resources to skip during rollback
 */
class ContinueUpdateRollbackCommand {
  constructor(input: ContinueUpdateRollbackCommandInput);
}

interface ContinueUpdateRollbackCommandInput {
  /** Name or ARN of the stack to continue rolling back */
  StackName: string;
  
  /** IAM service role for rollback operations */
  RoleARN?: string;
  
  /** Resources to skip during rollback */
  ResourcesToSkip?: string[];
  
  /** Unique identifier for idempotency */
  ClientRequestToken?: string;
}

Update Termination Protection

Enables or disables termination protection for a stack.

/**
 * Enables or disables termination protection for a stack
 * Protected stacks cannot be deleted until protection is disabled
 */
class UpdateTerminationProtectionCommand {
  constructor(input: UpdateTerminationProtectionCommandInput);
}

interface UpdateTerminationProtectionCommandInput {
  /** Enable or disable termination protection */
  EnableTerminationProtection: boolean;
  
  /** Name or ARN of the stack */
  StackName: string;
}

interface UpdateTerminationProtectionCommandOutput {
  /** Unique stack identifier */
  StackId?: string;
}