Skip to main content

Bootstrap your AWS CDK project resources by running CLI commands

Project description

Windsor

Toolkit to speed up AWS CDK applications development.

windsor is a CLI tool built by Westpoint to increase the development speed of applications built using AWS CDK by injecting pre-made code into the project as well as managing dependencie versions and project configurations.

System requirements

To use windsor and all of its features make sure you have the following dependencies installed.

Installation

Install windsor using PyPI

pip install windsor

Getting started

Create a CDK application using windsor

Each CDK app have its own dependencies and must be in its own folder. Start by creating an empty folder in your terminal.

$ mkdir my-app
$ cd my-app

Start a CDK application running windsor init.

The init command doesn't need to be ran in an empty folder. If you want to use windsor in a project already started, the command init will identify your project and create the a configuration file for it.

Control your dependencies

Windsor can help you manage your CDK dependencies by locking the version of @aws-cdk/core and providing commands to install and update these dependencies. The following example shows how to install the package @aws-cdk/aws-lambda.

windsor install aws-lambda

Notice that you also don't need to specify the namespace @aws-cdk, windsor will prefix that in all packages listed to install.

If you have packages with different versions, windsor provides a command to update all of them to the version specified in the CDKVersion attribute of windsor.json file. To update all your packages run.

windsor lock

Generating resources

windsor is able to generate resources with the command generate. Each resource generate will be in the form a CDK Construct, meaning that you can extend them and customize as you wish. Obs: windsor doesn't inject code in files that already exists in your project, that means that for every generated resource, you will need to instanciate the construct into your stack.

windsor generate lambda-function --function-name HelloWorld

The example above shows how to generate a lambda function. The only required parameter to generate lambda functions is function-name, since windsor will store a default runtime for them in its configuration. To change the default runtime change the attribute DefaultRuntime in windsor configuration file.

Resources available

lambda-function

Parameters:

  • function-name
  • runtime

Example

import * as cdk from '@aws-cdk/core';
import HelloWorldFunction from './constructs/helloworld';

export class WindsortestStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new HelloWorldFunction(this, 'HelloWorldFunction');
  }
}

codepipeline-react

A Pipeline that builds a React Application and sends to a S3 Bucket. The source stage pull code from Github and is triggered every time the branch (specified with the parameter branch) is updated.

Parameters:

  • pipeline-name

Example:

import * as cdk from '@aws-cdk/core';
import ReactPipeline from './constructs/react-pipeline';

export class WindsortestStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new ReactPipeline(this, 'ReactPipeline', {
      owner: 'REPOOWNER',
      repo: 'REPONAME',
      oauthToken: 'YOURTOKEN'
    });
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

windsor-1.0.1.tar.gz (11.2 kB view hashes)

Uploaded Source

Built Distribution

windsor-1.0.1-py3-none-any.whl (17.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page