# Cloud Accounts

Saved cloud accounts hold AWS IAM roles, VPC IDs, GCP network details, and related credentials. BYOC, VPC Peering, and PrivateLink reuse them. Send these requests to `https://api.laserdata.cloud`.

Reading requires `settings:read`. Creation, updates, and deletion require `settings:manage`.

## Create a Cloud Account

`POST /tenants/{tenant_id}/cloud_accounts`

Register a new cloud account. Supports AWS and GCP.

```bash
curl -X POST https://api.laserdata.cloud/tenants/{tenant_id}/cloud_accounts \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "cloud": "aws",
  "name": "production-aws",
  "account_id": "123456789012",
  "region": "us-west-1",
  "settings": {
    "aws": {
      "identity_arn": "arn:aws:iam::123456789012:role/LaserDataRole",
      "external_id": "unique-external-id",
      "vpc_id": "vpc-0abc123def456",
      "vpc_cidr": "10.0.0.0/16"
    }
  },
  "remarks": "Main production AWS account"
}'
```

| Field | Required | Description |
| --- | --- | --- |
| `cloud` | Yes | Cloud provider: `aws` or `gcp` |
| `name` | Yes | Unique name (1-100 chars) |
| `account_id` | Yes | Cloud provider account ID (e.g. AWS 12-digit account number) |
| `region` | No | Default region for this account |
| `settings` | No | Cloud-specific credentials (see below) |
| `remarks` | No | Notes (max 500 chars) |

AWS configuration:

| Field | Required | Description |
| --- | --- | --- |
| `identity_arn` | Yes | IAM role ARN that LaserData assumes for provisioning |
| `external_id` | Yes | External ID for secure cross-account role assumption |
| `vpc_id` | Yes | VPC ID where infrastructure will be provisioned |
| `vpc_cidr` | No | CIDR block of the VPC (used for network planning) |

GCP configuration:

| Field | Required | Description |
| --- | --- | --- |
| `vpc_network` | No | VPC network name for infrastructure provisioning |
| `vpc_cidr` | No | CIDR block of the VPC |

A successful request returns `201 Created`.

***

## List Cloud Accounts

`GET /tenants/{tenant_id}/cloud_accounts`

List all registered cloud accounts for the tenant.

```bash
curl "https://api.laserdata.cloud/tenants/{tenant_id}/cloud_accounts?page=1&results=10" \
-H "ld-api-key: YOUR_API_KEY"
```

```json
{
  "total_pages": 1,
  "total_results": 1,
  "page": 1,
  "items": [
    {
      "id": 1,
      "cloud": "aws",
      "name": "production-aws",
      "account_id": "123456789012",
      "region": "us-west-1",
      "validated_at": null,
      "status": "active",
      "created_at": "2026-06-01T10:00:00Z",
      "updated_at": "2026-06-01T10:00:00Z"
    }
  ]
}
```

Account statuses are `active`, `inactive`, `locked`, and `deleted`.

| Query Parameter | Description |
| --- | --- |
| `name` | Filter by name (contains match) |
| `cloud` | Filter by provider: `aws`, `gcp` |
| `region` | Filter by region (contains match) |

***

## Get Cloud Account

`GET /tenants/{tenant_id}/cloud_accounts/{cloud_account_id}`

Retrieve a specific cloud account. The detailed response includes settings and remarks omitted from the list.

```bash
curl https://api.laserdata.cloud/tenants/{tenant_id}/cloud_accounts/{cloud_account_id} \
-H "ld-api-key: YOUR_API_KEY"
```

```json
{
  "id": 1,
  "cloud": "aws",
  "name": "production-aws",
  "account_id": "123456789012",
  "region": "us-west-1",
  "status": "active",
  "settings": {
    "aws": {
      "identity_arn": "arn:aws:iam::123456789012:role/LaserDataRole",
      "external_id": "unique-external-id",
      "vpc_id": "vpc-0abc123def456",
      "vpc_cidr": "10.0.0.0/16"
    }
  },
  "remarks": "Main production AWS account",
  "created_at": "2026-06-01T10:00:00Z",
  "updated_at": "2026-06-01T10:00:00Z"
}
```

***

## Update Cloud Account

`PUT /tenants/{tenant_id}/cloud_accounts/{cloud_account_id}`

Update any cloud account field. All fields are optional. Include only what you want to change. Set an optional field to null to clear it.

```bash
curl -X PUT https://api.laserdata.cloud/tenants/{tenant_id}/cloud_accounts/{cloud_account_id} \
-H "ld-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "name": "production-aws-updated",
  "region": "us-west-2",
  "status": "active"
}'
```

| Field | Description |
| --- | --- |
| `name` | New name (must be unique within the tenant) |
| `account_id` | Updated cloud account ID |
| `region` | Updated region, or `null` to clear |
| `settings` | Updated credentials, or `null` to clear |
| `remarks` | Updated notes, or `null` to clear |
| `status` | Account status: `active`, `inactive`, `locked`, `deleted` |

A successful request returns `204 No Content`.

***

## Delete Cloud Account

`DELETE /tenants/{tenant_id}/cloud_accounts/{cloud_account_id}`

Permanently delete a cloud account. Existing BYOC deployments using this account continue running but cannot be reprovisioned.

```bash
curl -X DELETE https://api.laserdata.cloud/tenants/{tenant_id}/cloud_accounts/{cloud_account_id} \
-H "ld-api-key: YOUR_API_KEY"
```

A successful request returns `204 No Content`.

- [BYOC Setup Guide](/deployments/byoc): Full BYOC configuration walkthrough
- [Networking](/api/networking): VPC peering and PrivateLink

Source: https://docs.laserdata.com/api/cloud-accounts
