Visualize your cloud architecture with Cloudcraft by Datadog, the best way to create smart AWS and Azure diagrams.
Cloudcraft supports both manual and programmatic diagramming, as well as automatic reverse engineering of existing cloud environments into beautiful system architecture diagrams.
This cloudcraft
Node library provides an easy-to-use native Node SDK for interacting with
the Cloudcraft API.
Use case examples:
- Snapshot and visually compare your live AWS or Azure environment before and after a deployment, in your app or as part of your automated CI pipeline
- Download an inventory of all your cloud resources from a linked account as JSON
- Write a converter from a third party data format to Cloudcraft diagrams
- Backup, export & import your Cloudcraft data
- Programmatically create Cloudcraft diagrams
This SDK requires a Cloudcraft API key to use. A free trial of Cloudcraft Pro with API access is available.
Node 22 or higher.
To install cloudcraft
, run:
npm install cloudcraft --save
Or, if you prefer yarn
:
yarn add cloudcraft
The API is accessed through the Cloudcraft
class. An API key available through the Cloudcraft user interface is
required when instantiating Cloudcraft
. It can be passed to the class as an argument or through the
CLOUDCRAFT_API_KEY
environment variable:
import { Cloudcraft } from 'Cloudcraft';
const client = new Cloudcraft('api_key...');
(async () => {
const user = await client.user.me();
console.log(user.name);
})();
The package can be initialized with several options:
import { Cloudcraft } from 'Cloudcraft';
const client = new Cloudcraft('api_key...', {
host: 'customhost',
});
Option | Default | Description |
---|---|---|
maxNetworkRetries |
10 | The amount of times a request should be retried. |
timeout |
80_000 | Maximum time each request can take in ms. |
host |
'api.cloudcraft.co' |
Host that requests are made to. |
port |
443 | Port that requests are made to. |
protocol |
'https' |
'https' or 'http' . |
const client = new Cloudcraft();
const blueprints = await client.blueprint.list();
const client = new Cloudcraft();
const blueprint = await client.blueprint.get('id');
const client = new Cloudcraft();
const blueprint = await client.blueprint.create({
data: {
grid: 'standard',
name: 'My new blueprint',
},
});
const client = new Cloudcraft();
const blueprint = await client.blueprint.get('id');
blueprint.data.name = 'My updated blueprint';
await client.blueprint.update(blueprint);
const client = new Cloudcraft();
const blueprint = await client.blueprint.get('id');
const svg = (await client.blueprint.export(
blueprint.id,
Cloudcraft.BlueprintFormat.SVG
)) as string;
const client = new Cloudcraft();
const blueprint = await client.blueprint.get('id');
await client.blueprint.delete(blueprint.id);
const client = new Cloudcraft();
const awsAccount = await client.awsAccount.create(
{
name: 'Test account',
roleArn: 'arn:...',
},
'us-east-1',
);
const client = new Cloudcraft();
const awsAccounts = await client.awsAccount.list();
const client = new Cloudcraft();
const awsAccounts = await client.awsAccount.list();
const awsAccount = awsAccounts.find(
(awsAccount) => awsAccount.id === 'id'
) as any;
const svg = (await client.awsAccount.snapshot(
awsAccount.id,
'us-east-1',
Cloudcraft.BlueprintFormat.SVG
)) as string;
const client = new Cloudcraft();
const awsAccounts = await client.awsAccount.list();
const awsAccount = awsAccounts.find(
(awsAccount) => awsAccount.id === 'id'
) as any;
awsAccount.name = 'Updated account';
const updatedAWSAccount = await client.awsAccount.update(awsAccount);
const client = new Cloudcraft();
const awsAccounts = await client.awsAccount.list();
const awsAccount = awsAccounts.find(
(awsAccount) => awsAccount.id === 'id'
) as any;
await client.awsAccount.delete(awsAccount.id);
const client = new Cloudcraft();
const iamParameters = await client.awsAccount.iamParameters();
const client = new Cloudcraft();
const blueprint = await client.blueprint.create(testBlueprint);
const csv = (await client.budget.export(
blueprint.id,
Cloudcraft.BudgetFormat.CSV
)) as string;
const client = new Cloudcraft();
const user = await client.user.me();
Anyone can help make cloudcraft
better. Check out the contribution guidelines for more information.
Released under the Apache-2.0 License.