Skip to content

Latest commit

 

History

History
198 lines (149 loc) · 6.95 KB

README.md

File metadata and controls

198 lines (149 loc) · 6.95 KB

Armkit (Azure Cloud Development Kit)

Badges

Build npm version

Contributing and Feedback

CDK for Azure is an early experimental project and the development folks would love your feedback to help guide the project.

We welcome community contributions and pull requests. See CONTRIBUTING for information on how to set up a development environment and submit code.

Summary

Armkit, Azure Cloud Development Kit (CDK), is an open source software development framework to define cloud Infrastructure as Code (IaC) and provision it through Azure ARM Templates.

It offers a high-level object-oriented abstraction to define Azure resources imperatively using the power of modern programming languages. Using the Armkit library of infrastructure constructs, you can easily encapsulate Azure best practices in your infrastructure definition and share it without worrying about boilerplate logic.

Armkit is available in the following languages:

Background

Developers use the Armkit framework in one of the supported programming languages to define reusable cloud components called constructs, which are composed together into stacks, forming an "Armkit app".

They then use the Armkit CLI to interact with their Armkit app. The CLI allows developers to synthesize artifacts such as Azure ARM Templates, deploy stacks to development Azure accounts and diff against a deployed stack to understand the impact of a code change.

The Armkit Construct Library includes a module for each Azure service with constructs that offer rich APIs that encapsulate the details of how to use Azure. The Armkit Construct Library aims to reduce the complexity and glue-logic required when integrating various Azure services to achieve your goals on Azure.

Armkit packages:

  • @armkit/core - A library that allows users to build Azure applications contructs.
  • armkit-resources - A library for defining Azure resources using programming constructs.
  • armkit-cli - A CLI that allows users to run commands to initialize, import, and synthesize Armkit applications.

Examples

Some sample constructs are in examples. This could look like this:

helloArmkit.ts

import { Construct } from "constructs";
import { App, ArmStack } from "@yetics/armkit-core";
import {
  ContainerGroups,
  ContainerGroupPropertiesOsType,
  MicrosoftContainerInstanceContainerGroupsType,
  MicrosoftContainerInstanceContainerGroupsApiVersion,
} from "./.generated/ContainerInstance-2021-03-01";
import {
  Registries,
  MicrosoftContainerRegistryRegistriesApiVersion,
  MicrosoftContainerRegistryRegistriesType,
  SkuName,
} from "./.generated/ContainerRegistry-2019-05-01";

export class HelloArmkit extends ArmStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new ContainerGroups(this, "MyContainerGroup", {
      name: "azurecdktest",
      location: "westeurope",
      apiVersion:
        MicrosoftContainerInstanceContainerGroupsApiVersion["2021_03_01"],
      type:
        MicrosoftContainerInstanceContainerGroupsType.MICROSOFT_CONTAINER_INSTANCE_CONTAINER_GROUPS,
      properties: {
        containers: [
          {
            name: "ubuntu-server",
            properties: {
              image: "ubuntu:18.04",
              command: ["sleep infinity"],
              resources: {
                requests: {
                  cpu: 1,
                  memoryInGB: 2,
                },
                limits: {
                  cpu: 1,
                  memoryInGB: 2,
                },
              },
            },
          },
        ],
        osType: ContainerGroupPropertiesOsType.LINUX,
      },
    });

    new Registries(this, "azurecdktest", {
      name: "azurecdktest",
      location: "westeurope",
      apiVersion: MicrosoftContainerRegistryRegistriesApiVersion["2019_05_01"],
      type:
        MicrosoftContainerRegistryRegistriesType.MICROSOFT_CONTAINER_REGISTRY_REGISTRIES,
      sku: {
        name: SkuName.BASIC,
      },
      properties: {
        adminUserEnabled: false,
      },
    });
  }
}

const app = new App({ outdir: "cdk.out" });
new HelloArmkit(app, "hello-armkit");
app.synth();

For a detailed walk through, see the Armkit Developer Guide.

Building

Clone the project repository

git clone https://github.com/Yetics/armkit.git

Download dependencies and build node.js

cd armkit/
yarn install
yarn build

Build the examples/basic package:

Go to examples/basic:

cd /examples/basic

Generate the armkit cdk libs:

yarn generate

Translate typescript to node.js:

yarn build

Render ARM template from CDK:

node index.js

Check out the results:

az deployment group create --resource-group <resource-group-name> --template-file @cdk-out/helloarmkit.json

Roadmap

The Armkit Roadmap project board lets developers know about our upcoming features and priorities to help them plan how to best leverage Armkitand identify opportunities to contribute to the project. See ROADMAP for more information and FAQs.

License

Armkit is distributed under the Apache License, Version 2.0.

See LICENSE and NOTICE for more information.