Docs

Follow removal

Following removal means showing the customer where their removal stands until nothing of yours is left to manage. It applies when you launch the portal with a Deploy button or build it in with your own setup screen, after you start the removal.

Example UI /Waiting for the admin

Document processing

Settings · Deploy in your cloud

Action needed

Delete the setup stack to finish

We removed the service. Your AWS admin finishes by deleting the CloudFormation stack that setup created.

aws cloudformation delete-stack --stack-name a3f9c21b0-customer-1 --region us-east-1

Stack
a3f9c21b0-customer-1
Region
us-east-1
Copy commandSend to an admin

The split follows the two parts of a deployment's life:

  • Ongoing management: Alien created the live resources, so Alien deletes them.
  • Initial setup: the admin created the management identity and the frozen resources with their own credentials, so the admin's teardown removes them, except the data you keep.

Statuses

Removal runs in the background. Your page shows one of these states, read from the deployment's status:

statusProduct stateWho acts next
delete-pending, deletingRemovingAlien
teardown-requiredWaiting for the adminThe customer's admin
retention-requiredWaiting for the admin, data keptThe customer's admin
delete-failedRemoval stoppedYour team
teardown-failedThe admin's teardown failedThe customer's admin
retainedRemoved, data keptYou: close the record
deletedRemovedYou: close the record

Removing

While Alien deletes the live resources, your page has nothing for anyone to do. Say where the work goes now, as in the example on Remove a deployment.

Show it when status is delete-pending or deleting.

  • Traffic first. Switch your product off the deployment before you start removal, and say where the work goes now.
  • No Cancel. The API can't stop a removal once it starts. Don't offer the button.
  • Who and when. Save who started removal and when in your own database. The response doesn't return it.
  • Repeat clicks. Calling delete again while it runs is safe: it doesn't start a second removal.
GET /v1/deployments/{id}
{
  "status": "deleting",
  "platform": "aws",
  "environmentInfo": { "platform": "aws", "accountId": "123456789012", "region": "us-east-1" },
  "error": null,
  "retryRequested": false
}

Waiting for the admin

teardown-required means Alien's part is done and the customer's part isn't. Give the step for the admin's setup method, from setupMethod:

setupMethodWhat the admin does
cloudformationDelete the stack: "Delete the a3f9c21b0-customer-1 stack in CloudFormation in us-east-1."
terraformIn the Terraform folder, set TF_VAR_token to the deployment token from initial setup (and on AWS TF_VAR_management_external_id), then run terraform destroy.
helmRun helm uninstall.
cliRun your CLI's destroy command, such as acmectl destroy --deployment-id <id>, with the cloud credentials used for initial setup.

The example at the top of this page shows this state.

Show it when status is teardown-required or retention-required. setupMethod says which step to show.

  • Name the admin. Alien's part is done. Say the customer's admin acts next, and give the exact step for their setupMethod.
  • Days, not minutes. Keep the card on the page and remind the admin, instead of hiding it.
  • Data kept. retention-required means the data resources stay. The admin still removes the setup stack; the data stays in the account.
  • The link can go. The stack deletes itself with the deployment's own token, so revoking the setup link doesn't block this step.
GET /v1/deployments/{id}
{
  "status": "teardown-required",
  "platform": "aws",
  "setupMethod": "cloudformation",
  "environmentInfo": { "platform": "aws", "accountId": "123456789012", "region": "us-east-1" },
  "error": null
}

When the admin's teardown reaches Alien, the status becomes deleted, or retained when data was kept. The deployment portal shows the admin the same step under Finish uninstall, with the exact command for every setup method: see Follow a deployment.

Failures

delete-failed means Alien couldn't delete a live resource. Show error.message, tell the customer your team is on it, and see Debug a deployment.

teardown-failed means the admin's teardown stopped, for example a stack deletion that failed in AWS:

Example UI /Teardown failed

Document processing

Settings · Deploy in your cloud

Removal stopped

The setup stack didn’t delete

The service is gone, but the setup stack in your AWS account is still there.

Open the stack’s Events tab in CloudFormation to see which resource failed, fix it, then delete the stack again.

Copy commandContact support

Show it when status is teardown-failed. Show error.message.

  • The fix is in their account. Tell the admin where to look: the stack's Events tab in CloudFormation, or the terraform destroy output.
  • Azure resource groups. Terraform won't delete a resource group that still holds resources, such as a kept Key Vault. The admin deletes those first.
  • Then retry. After the fix, the admin deletes the stack or runs terraform destroy again. Nothing changes on your side.
  • delete-failed is different. It means Alien couldn't delete a live resource, and your team acts.
GET /v1/deployments/{id}
{
  "status": "teardown-failed",
  "platform": "aws",
  "setupMethod": "cloudformation",
  "error": {
    "code": "CLOUD_PLATFORM_ERROR",
    "message": "The setup stack could not delete the management role.",
    "retryable": true
  }
}

Removed

deleted and retained are the end of removal. Some things stay until the customer deletes them, and they may still cost money.

Example UI /Removed

Document processing

Settings · Deploy in your cloud

Removed

Removed from Document processing

Data that setup didn’t create, such as an existing VPC or a bucket you kept, stays in your account until you delete it.

Removed
Jan 20, 15:41
Deploy again

Show it when status is deleted or retained.

  • Say what stays. With retained, list the kept data, such as the bucket with their documents. With either, an existing VPC the customer named stays too.
  • Honest wording. Say "Removed from Document processing", not "Nothing left in your account".
  • Close your record. Clear your active flag and endpoint, then revoke the setup link from the deployment group's Deployment links card.
  • Deploy again. Deploy again creates a new setup link for the same customer.
GET /v1/deployments/{id}
{
  "status": "retained",
  "platform": "aws",
  "setupMethod": "cloudformation",
  "error": null
}

Map the status

Server. Poll the deployment and map its status:

lib/removal-state.ts
import { alien } from "./alien"

export async function removalState(deploymentId: string) {
  const d = await alien.deployments.get({ id: deploymentId })
  switch (d.status) {
    case "delete-pending":
    case "deleting":
      return { state: "removing" }
    case "teardown-required":
    case "retention-required":
      return { state: "waiting-for-admin", setupMethod: d.setupMethod }
    case "delete-failed":
    case "teardown-failed":
      return { state: "failed", status: d.status, message: d.error?.message }
    case "deleted":
    case "retained":
      return { state: "removed", dataKept: d.status === "retained" }
    default:
      return { state: d.status }
  }
}

Test it

  • Remove a test deployment end to end. Check that your page shows Removing, then Waiting for the admin with the right command, then Removed only after deleted or retained.
  • Wait from the CLI while you watch your page: alien deployments wait customer-1/customer-1 --for deleted --timeout 1h.
  • Delete the stack too early. On a second deployment, delete the stack in AWS before you start removal. Alien should remove the deployment, and your page should reach Removed.
  • Unit-test the failures. Feed the Teardown failed response to your mapping, and assert your page shows the error and names the admin.

Next

On this page