Package: halloumi-ami-pipelines
IntroductionAMI 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:CentOS7CentOS8Ubuntu1804Ubuntu2004This is a sample configuration:---pipeline:parent_image:AmazonLinux2# or Ubuntu2004 or CentOS7cpu_type:X86_64# or ARM_64. X86_64 is the default when the parameter is missing. ARM_64 doesn't work for CentOS 7 and is ignored.iops:3000# Optional parameter to increase GP3 IOPS.sources:# Sources for use in the source stage of the Codepipeline.-name:Buckettype:s3bucket:kah-imagebuilder-s3-bucket-fraobject:test.zip-name:Codecommittype:codecommitrepo_name:testrepobranch:developrecipe:name:DemoCentoscomponents:-name:install_cloudwatch_agent# Reference to a name in the component_dependencies section-name:another_ec2_ib_component_from_github-name:install_nginxschedule:cron(0 4 1 * ? *)shared_with:# Optional: Share images with another account.-region:eu-west-1account_id:123456789copy_to:# Optional: Copy images to another account.-region:eu-west-1account_id:123456789component_dependencies:-name:another_ec2_ib_component_from_githubtype:gitbranch:masterurl:git@github.com:rainmaker2k/echo-world-component.git-name:install_cloudwatch_agenttype:gitbranch:masterurl:git@github.com:rainmaker2k/ec2ib_install_cloudwatch.git-name:install_nginxbranch:mastertype:giturl:git@github.com:sentiampc/ami-pipelines-base-components.gitpath:nginx# Optional: If you have multiple component configurations in this repository.-name:aws_managed_componenttype:aws_arnarn:arn:aws:imagebuilder:eu-central-1:aws:component/amazon-cloudwatch-agent-linux/1.0.0Get startedThis 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.jsfile.If you have not done so already, install projen throughnpm:$ npm install -g projenor$ npx projenAlso install yarn.$ npm install -g yarnWhen you first checkout this project run:$ projenThis 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 buildThis will create a dist directory and create distibutable packages for NPM and Pypi.ExamplesPythonHere is an example of a stack in CDK to create the pipelines. This example assumes you have the YAML configurations stored in.\ami_config\fromaws_cdkimportcorefromami_pipelinesimportPipelineBuilderimportosimportyamlimportglobclassDemoPyPipelineStack(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 theami_configdirectory.