Docs

Remove a deployment

Removing a deployment deletes your software from the customer's cloud when they turn the feature off or leave. This page is for products that launch the portal with a Deploy button or build it in with your own setup screen. When you send a link, your team removes deployments from the dashboard or CLI.

Example UI /Removing

Document processing

Settings · Deploy in your cloud

Removing

Removing the service from your AWS account

Documents are processed by our hosted service again. This usually takes a few minutes.

Account
123456789012 · us-east-1
Removal started
Jan 20, 14:02 by dana@customer-1.example

Your product starts removal with one API call. Alien deletes what it manages, and the customer's admin deletes what their initial setup created:

  1. 1

    Start removalyou

    Your backend calls delete with action cleanup.

  2. 2

    Delete live resourcesAlien

    Alien removes what it created on each release.

  3. 3

    Delete the stackcustomer admin

    Status is teardown-required or retention-required until the admin deletes the stack.

  4. 4

    Close the recordyou

    Status becomes deleted, or retained when data was kept. Clear your state.

Follow removal covers each state after the call.

Switch traffic off first

Server. Before you call delete, move your product off the deployment:

  • Point traffic back to your hosted service.
  • Stop sending work to the customer's endpoint.
  • Clear your own active flag.

Once removal starts, the endpoint can disappear at any moment.

Start removal

Server. Removal needs a key with the project.admin role. Create one with alien api-keys create --for project-admin, and keep it apart from the key that reads status.

POST /v1/deployments/{id}/delete with action: "cleanup". Cleanup keeps the customer's data: see Keep or erase data.

lib/remove.ts
import { Alien } from "@alienplatform/platform-api"

// A project.admin key: alien api-keys create --for project-admin
const admin = new Alien({ apiKey: process.env.ALIEN_ADMIN_API_KEY, workspace: "acme" })

export async function removeDeployment(deploymentId: string) {
  const res = await admin.deployments.delete(deploymentId, { action: "cleanup" })
  return res.message
}

The call accepts the request and returns. Your page follows removal by polling, below.

Your team can also remove a deployment by hand, for example from support. In the dashboard, open the deployment under Deployments and delete it: the Delete Deployment dialog asks you to type the deployment's name. From the CLI:

alien deployments delete customer-1/customer-1

Keep or erase data

Some resources hold the customer's data: buckets, databases, key-value stores, queues, vaults, and keys. By default, removal keeps them in the customer's account.

actionData resourcesCLI
cleanup or retainKept in the customer's accountalien deployments delete customer-1/customer-1
eraseDeleted, permanentlyalien deployments delete customer-1/customer-1 --erase-data
  • Ask before you erase. Erasing can't be undone. Confirm it with the customer in your product, in words: "Delete all documents stored in your AWS account."
  • Erase later. A removal that kept data can be turned into an erase afterwards: call delete again with action: "erase".
  • One choice at a time. While a removal runs, a request with the other choice fails with 409 DEPLOYMENT_DELETE_POLICY_CONFLICT. Wait for it to finish.

Other delete actions

actionUse
cleanupThe normal path above. Keeps data, like retain.
retainSame as cleanup.
eraseAlso deletes the data resources. See Keep or erase data.
forgetDelete only Alien's record, without touching the cloud. Use it for a deployment whose initial setup never ran, or whose resources are already gone. Needs a workspace admin key. From the CLI: alien deployments delete customer-1/customer-1 --force customer-1.
detachStop managing an imported pull deployment without deleting it.

Never use forget on a deployment whose initial setup ran: the resources keep running in the customer's account with nothing managing them.

The cleanup call over REST, for readers without one of the languages above:

curl --fail-with-body -X POST "https://api.alien.dev/v1/deployments/$DEPLOYMENT_ID/delete" \
  -H "Authorization: Bearer $ALIEN_ADMIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action": "cleanup"}'

The stack holds the deployment's own token, not the setup link's, so revoking the link doesn't block removal.

Once the status is deleted, revoke any link you no longer need from the deployment group's Deployment links card in the dashboard. Stacks launched with the link's own token, before deployments were created first, can still finish deletion after the link stops working; see Link lifetime.

Test it

  • Remove with data. Upload a file to the deployment's bucket, remove it with cleanup, and confirm the bucket is still in the account after retained.
  • Click twice. Start removal twice, and confirm the second call doesn't start a second removal.
  • Erase later. Remove with cleanup, then call delete with action: "erase", and confirm the bucket is gone.

Next

On this page