The blueprint CLI
Working with blueprint tooling
To work with the blueprint tools
Open the CodeCatalyst console at https://codecatalyst.aws/
. -
Resume your Dev Environment. For more information, see Resuming a Dev Environment.
If you don't have a Dev Environment, you must first create one. For more information, see Creating a Dev Environment.
-
In a working terminal, run the following the command to install the blueprint CLI:
npm install -g @amazon-codecatalyst/blueprint-util.cli
-
In the
blueprint.ts
file, import the tools you want to use in the following format:import {
<tooling-function-name>
} from '@amazon-codecatalyst/blueprint-util.cli/lib/<tooling-folder-name>
/<tooling-file-name>
;Tip
You can to the
CodeCatalyst blueprints GitHub repository
to find the name of the tooling you want to use. If you want to use the image uploading tool, add the following to your script:
import { uploadImagePublicly } from '@amazon-codecatalyst/blueprint-util.cli/lib/image-upload-tool/upload-image-to-aws';
Examples
-
If you want to use the publishing function, add the following to your script:
import { publish } from '@amazon-codecatalyst/blueprint-util.cli/lib/publish/publish';
-
If you want to use the image uploading tool, add the following to your script:
import { uploadImagePublicly } from '@amazon-codecatalyst/blueprint-util.cli/lib/image-upload-tool/upload-image-to-aws';
-
-
Call the function.
Examples:
-
If you want to use the publishing function, add the following to your script:
await publish(logger, config.publishEndpoint, {
<your publishing options>
}); -
If you want to use the image uploading tool, add the following to your script:
const {imageUrl, imageName} = await uploadImagePublicly(logger, 'path/to/image'));
-
Image upload tool
The image upload tool provides you with the ability to upload your own image to an S3 bucket in your AWS account and then distribute that image publicly behind CloudFront. The tool takes an image path in the local storage (and optional bucket name) as input, and returns the URL to the image that is publicly available. For more information, see What is Amazon CloudFront? and What is Amazon S3?
To work with the image upload tool
-
Clone the open-source blueprints GitHub repository
that provides access to the blueprints SDK and sample blueprints. In a working terminal, run the following command: git clone https://github.com/aws/codecatalyst-blueprints.git
-
Run the following command to navigate to the blueprints GitHub repository:
cd codecatalyst-blueprints
-
Run the following command to install dependencies:
yarn && yarn build
-
Run the following command to make sure the latest blueprint CLI version is installed:
yarn upgrade @amazon-codecatalyst/blueprint-util.cli
-
Log in to the AWS account with the S3 bucket you want to upload your image to. For more information, see Configure the AWS CLI, and Sign in through the AWS Command Line Interface.
-
Run the following command from the root of your CodeCatalyst repository to navigate to the directory with the blueprint CLI:
cd packages/utils/blueprint-cli
-
Run the following command to upload your image to an S3 bucket:
yarn blueprint upload-image-public
<./path/to/your/image>
<optional:optional-bucket-name>
A URL to your image is generated. The URL won’t be available immediately since it requires some time for the CloudFront distribution to be deployed. Check the distribution status to get the latest deployment status. For more information, see Working with distributions.