Giter Site home page Giter Site logo

cloudformation-builder's Introduction

cloudformation-builder

Build Status Codacy Badge codecov

CloudFormation-Builder is a Java 8 DSL for creating AWS CloudFormation templates.

Quick Start

Dependency

Use jitpack to import this project as a maven dependency.

<dependency>
    <groupId>com.github.StuPro-TOSCAna</groupId>
    <artifactId>cloudformation-builder</artifactId>
    <version>{releaseVersion/commitHash}</version>
</dependency>

Use a release version or simply the hash of a commit to specify the version.

Example

CloudFormation templates are built within a so-called Module. This module gets filled with all the CloudFormation resources needed to build the template.

The following is a quick example on how a CloudFormation template is built with the CloudFormation Builder:

class Ec2withEbsModule extends Module {
    public void build() {
        this.template.setDescription("Ec2 block device mapping");

        EC2EBSBlockDevice ec2EBSBlockDeviceA = new EC2EBSBlockDevice()
                .volumeType("io1")
                .iops(200)
                .deleteOnTermination(false)
                .volumeSize("20");
        EC2BlockDeviceMapping ec2BlockDeviceMappingA = new EC2BlockDeviceMapping()
                .deviceName("/dev/sdm")
                .ebs(ec2EBSBlockDeviceA);

        EC2BlockDeviceMapping ec2BlockDeviceMappingB = new EC2BlockDeviceMapping()
                .deviceName("/dev/sdk")
                .noDevice(false);

        resource(Instance.class, "MyEC2Instance")
                .imageId("ami-79fd7eee")
                .keyName("testkey")
                .blockDeviceMappings(ec2BlockDeviceMappingA, ec2BlockDeviceMappingB);
    }
}

Note: The example is taken from the InstanceTest. See /src/test/java/com/scaleset/cfbuilder/ for more tests containing examples that you can use.

This Ec2withEbsModule results in the following CloudFormation template:

AWSTemplateFormatVersion: "2010-09-09"
Description: "Ec2 block device mapping"
Resources:
  MyEC2Instance:
    Type: "AWS::EC2::Instance"
    Properties:
      ImageId: "ami-79fd7eee"
      KeyName: "testkey"
      BlockDeviceMappings:
      - DeviceName: "/dev/sdm"
        Ebs:
          DeleteOnTermination: false
          Iops: 200
          VolumeSize: "20"
          VolumeType: "io1"
      - DeviceName: "/dev/sdk"
        NoDevice: false

Contributing

See our contribution guidelines for detailed information on how to contribute to the cloudformation-builder.

Tools

Tools that are used in this project.

License

CloudFormation-Builder is licensed under the Apache License 2.0.

cloudformation-builder's People

Contributors

christopherlakey avatar mklopp avatar mmunozba avatar c-mueller avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar Nick Fode avatar  avatar  avatar

cloudformation-builder's Issues

Add changelog for changed things

If people are looking for a cloudformation-builder and find this one a change log that shows what has changed compared to the original one might be helpful. I think because of the Apache 2.0 license this is mandatory.

Issues with !Ref and !GetAtt

Issues I came across when trying to test my DBInstance

  • If I use template.ref ("Reference") the template will get created with
    • Ref: "Reference" instead of !Ref "Reference"
  • Is !GetAtt functionality missing?
    • Fn::GetAtt: possible, but what does this mean?

Enforce more type safety

Currently, major parts of the code are not type safe even though they could be.

  • Investigate which code parts can be made more type-safe.
  • Change the implementation

Make required/conditional properties actually required/conditional

Currently, a lot of properties of CloudFormation resources can be set or not set freely even though the CloudFormation specification specifies otherwise. E.g. required properties, properties that are mutually exclusive etc.
While this might not be an issue for users that are familiar with the specification, it would definitely simplify the creation of templates.

  • Investigate which code parts can be improved to be more close to the CloudFormation spec
  • Change the implementation

Deployment of lamp-template fails

Currently, the Deployment of the template created by the CloudFormationBuilderTest fails on AWS.
I'm currently investigating the causes of this and will fix those as soon as I have found all of them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.