Skip to main content

halloumi-ami-pipelines

Project description

Introduction

AMI Pipelines is a library for creating EC2 Image Builder pipelines with configurations on a given path. EC2 Image Builder pipelines are pipelines that can help create AMI images, based on 1 or more steps, called components, in a defined image recipe. These pipelines will create the AMI's as configured. All you need is to create one or more YAML files in a given directory and the library will create the necessary CodePipelines, EC2 Image Builder pipelines and components for you.

Supported parent images:

  • CentOS7
  • CentOS8
  • Ubuntu1804
  • Ubuntu2004

This is a sample configuration:

---
pipeline:
  parent_image: AmazonLinux2 # or Ubuntu2004 or CentOS7

  sources: # Sources for use in the source stage of the Codepipeline.
    - name: Bucket
      type: s3
      bucket: kah-imagebuilder-s3-bucket-fra
      object: test.zip
    - name: Codecommit
      type: codecommit
      repo_name: testrepo
      branch: develop
  recipe:
    name: DemoCentos
    components:
        - name: install_cloudwatch_agent # Reference to a name in the component_dependencies section
        - name: another_ec2_ib_component_from_github
        - name: install_nginx
  schedule: cron(0 4 1 * ? *)
  shared_with: # Optional: Share images with another account. Image will be copied.
    - region: eu-west-1
      account_id: 123456789


component_dependencies:
  - name: another_ec2_ib_component_from_github
    type: git
    branch: master
    url: git@github.com:rainmaker2k/echo-world-component.git
  - name: install_cloudwatch_agent
    type: git
    branch: master
    url: git@github.com:rainmaker2k/ec2ib_install_cloudwatch.git
  - name: install_nginx
    branch: master
    type: git
    url: git@github.com:sentiampc/ami-pipelines-base-components.git
    path: nginx # Optional: If you have multiple component configurations in this repository.
  - name: aws_managed_component
    type: aws_arn
    arn: arn:aws:imagebuilder:eu-central-1:aws:component/amazon-cloudwatch-agent-linux/1.0.0

Get started

This is a Typescript project, managed through Projen. Projen is project management tool that will help you manage most of the boilerplate scaffolding, by configuring the .projenrc.js file.

If you have not done so already, install projen through npm:

$ npm install -g projen

or

$ npx projen

Also install yarn.

$ npm install -g yarn

When you first checkout this project run:

$ projen

This will create all the necessary files from what is configured in .projenrc.js, like package.json, .gitignore etc... It will also pull in all the dependencies.

If everything is successful, you can run the build command to compile and package everything.

$ projen build

This will create a dist directory and create distibutable packages for NPM and Pypi.

Examples

Python

Here is an example of a stack in CDK to create the pipelines. This example assumes you have the YAML configurations stored in .\ami_config\

from aws_cdk import core
from ami_pipelines import PipelineBuilder

import os
import yaml
import glob


class DemoPyPipelineStack(core.Stack):

    def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        print("Creating pipeline")
        pipeline_builder = PipelineBuilder()
        pipelines = pipeline_builder.create(self, "ami_config")

This assumes you have at least one pipeline config YAML in the ami_config directory.

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

halloumi-ami-pipelines-0.0.32.tar.gz (588.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

halloumi_ami_pipelines-0.0.32-py3-none-any.whl (587.1 kB view details)

Uploaded Python 3

File details

Details for the file halloumi-ami-pipelines-0.0.32.tar.gz.

File metadata

  • Download URL: halloumi-ami-pipelines-0.0.32.tar.gz
  • Upload date:
  • Size: 588.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

File hashes

Hashes for halloumi-ami-pipelines-0.0.32.tar.gz
Algorithm Hash digest
SHA256 e7619ec4495130b1f8a87fbb1e34b516b1a52cafe2f397f153de4407e6fec15b
MD5 b8adb0e3ccb6080a88f878cc2268530a
BLAKE2b-256 19d9351358498163bcc3f5d52c7d204a15352d789cf57510c994f906737ff0bd

See more details on using hashes here.

File details

Details for the file halloumi_ami_pipelines-0.0.32-py3-none-any.whl.

File metadata

  • Download URL: halloumi_ami_pipelines-0.0.32-py3-none-any.whl
  • Upload date:
  • Size: 587.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

File hashes

Hashes for halloumi_ami_pipelines-0.0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 95b2c01d51774b70f53e8d79ed60e16cd68f5053d419a61d65346e01fd29ccf1
MD5 6b0e6eeec9f55fb7968e765353eefe85
BLAKE2b-256 21e41dcde19353591bf641a02cdf04105f4b9bbcec2421b2a5f55a0350a143df

See more details on using hashes here.

Supported by

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