What is @aws-cdk/cx-api?
@aws-cdk/cx-api is a part of the AWS Cloud Development Kit (CDK) that provides a set of APIs for interacting with the Cloud Assembly, which is the output of the CDK synthesis process. It allows developers to programmatically access and manipulate the synthesized cloud infrastructure stacks, assets, and metadata.
What are @aws-cdk/cx-api's main functionalities?
Accessing Cloud Assembly
This feature allows you to load and interact with a Cloud Assembly, which is the output directory of a CDK app synthesis. The code sample demonstrates how to load a Cloud Assembly from a specified path and log the stacks it contains.
const cxapi = require('@aws-cdk/cx-api');
const assembly = new cxapi.CloudAssembly('/path/to/cloud-assembly');
console.log(assembly.stacks);
Reading Stack Metadata
This feature allows you to read metadata from a specific stack within the Cloud Assembly. The code sample shows how to get a stack by its name and log its metadata.
const cxapi = require('@aws-cdk/cx-api');
const assembly = new cxapi.CloudAssembly('/path/to/cloud-assembly');
const stack = assembly.getStackByName('MyStack');
console.log(stack.metadata);
Listing Assets
This feature allows you to list all the assets included in the Cloud Assembly. The code sample demonstrates how to log all the assets in the Cloud Assembly.
const cxapi = require('@aws-cdk/cx-api');
const assembly = new cxapi.CloudAssembly('/path/to/cloud-assembly');
console.log(assembly.assets);
Other packages similar to @aws-cdk/cx-api
aws-sdk
The AWS SDK for JavaScript provides a comprehensive set of APIs for interacting with AWS services. While it does not specifically focus on the Cloud Assembly or CDK synthesis output, it allows for a wide range of AWS service interactions, including managing infrastructure, which can complement the use of @aws-cdk/cx-api.
serverless
The Serverless Framework is a popular open-source framework for building and deploying serverless applications. It provides functionalities for defining and deploying cloud infrastructure, similar to the CDK, but focuses on serverless architectures. It does not provide direct access to a Cloud Assembly like @aws-cdk/cx-api.
terraform
Terraform by HashiCorp is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. It allows for the definition, preview, and deployment of cloud infrastructure. While it serves a similar purpose to the CDK, it does not have a direct equivalent to the Cloud Assembly or @aws-cdk/cx-api.