-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add functionality to retrieve security group by project name fr…
…om AWS Parameter Store
- Loading branch information
Showing
3 changed files
with
193 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| AMI Build Pipeline | ||
| Copy Morpheus.tf into a new file | ||
| Input new variables | ||
| Execute the Morpheus.tf | ||
| - Builds a new Code pipeline | ||
| - Downloads the packer Template | ||
| - Downloads the Anbile playbooks | ||
| - Downloads the Goss testing sutie | ||
| - Builds 3 new build jobs – | ||
| o Build Job calls Packer | ||
| o Packer creates the EC23 instance | ||
| o Packer calls ansible- Morpheus -arem:baseline.yaml | ||
| Installs Morpheus and configs on the EC2 | ||
| Makes sure Python is in the environment | ||
| Regiters and deregisters from Satellite | ||
|
|
||
|
|
||
| - Packer builds a new AMI from EC2 | ||
| o Register AMI with AWS | ||
| o Registers AMI with parameter store | ||
| - Packer deletes the EC2 instance | ||
| Sets up PIP | ||
| - Test Build | ||
| o Uses TF to create a instance of the AMI, image gets registered with AWS | ||
| o Logs into AMI and uploads the testing template to the instance | ||
| o Executes the test and ssh is working. | ||
| o If test fails then it de registers the image from AWS | ||
| o If pass AMI id get uploaded to Parameter Store | ||
|
|
||
| If creating a new image may need to tweak packer | ||
| Will need a new playbook to call roles | ||
| (Cloud have a standard sets for roles shared across all builds) | ||
| Customer will need to create the playbook to install and configure their app | ||
|
|
||
| Customer create a EC2 instance from Morpheus\Service Catalog and selects the respective AMI | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Project Summary | ||
|
|
||
| This document summarizes the AWS Image Pipeline project, outlining its purpose, structure, and key processes. | ||
|
|
||
| ## Overview | ||
|
|
||
| The AWS Image Pipeline is an automated solution for building, configuring, and testing Amazon Machine Images (AMIs) using AWS services and open-source tools. It streamlines the AMI creation process, ensuring consistency and security. | ||
|
|
||
| ## Key Components | ||
|
|
||
| * **Terraform (terraform-aws-image-pipeline):** Manages the AWS infrastructure required for the pipeline, including CodePipeline, CodeBuild, IAM roles, S3 buckets, and KMS keys. | ||
| * **Packer (linux-image-pipeline):** Defines the AMI build process, including the base image, configuration steps, and testing. | ||
| * **Ansible (image-pipeline-ansible-playbooks):** Automates the configuration of the EC2 instance during the AMI build process, including application installation and registration with services like Satellite. | ||
| * **Goss (image-pipeline-goss-testing):** Validates the AMI after it is built, ensuring it meets the required specifications. | ||
|
|
||
| ## Technical Implementation | ||
|
|
||
| ### Infrastructure Setup (Terraform) | ||
| * Creates AWS CodePipeline with multiple stages for orchestration | ||
| * Sets up CodeBuild projects for building and testing AMIs | ||
| * Manages IAM roles and policies for secure access | ||
| * Configures S3 buckets for storing artifacts and build outputs | ||
| * Sets up KMS keys for encryption of sensitive data | ||
| * Manages AWS Parameter Store entries for configuration | ||
|
|
||
| ### Build Process (Packer) | ||
| * Uses HCL-based templates (e.g., build.pkr.hcl, morpheus-build.pkr.hcl) | ||
| * Fetches configurations from AWS Parameter Store | ||
| * Integrates with AWS Secrets Manager for credentials | ||
| * Launches EC2 instances with specified configurations | ||
| * Coordinates with Ansible for instance configuration | ||
| * Handles AMI creation and registration | ||
| * Uses post-processors to update Parameter Store with AMI IDs | ||
|
|
||
| ### Configuration Management (Ansible) | ||
| * Organizes configurations using role-based architecture | ||
| * Provides roles for: | ||
| * Base system configuration | ||
| * Application installation | ||
| * Satellite registration/deregistration | ||
| * Python/PIP setup | ||
| * Volume mapping | ||
| * Integrates with AWS Parameter Store for dynamic configurations | ||
| * Handles both Linux and Windows environments | ||
| * Supports multiple deployment scenarios (Morpheus, GitHub Runner, etc.) | ||
|
|
||
| ### Testing Framework (Goss) | ||
| * Implements validation rules for AMI testing | ||
| * Executes tests on newly created instances | ||
| * Validates system configurations and installed software | ||
| * Integrates with CodePipeline for automated testing | ||
| * Supports both pass/fail scenarios with appropriate cleanup | ||
|
|
||
| ## Pipeline Workflow Details | ||
|
|
||
| 1. **Infrastructure Preparation** | ||
| * Terraform creates/updates required AWS resources | ||
| * Sets up secure communication channels and access controls | ||
| * Configures pipeline stages and build environments | ||
|
|
||
| 2. **Source Stage** | ||
| * Downloads Packer templates from S3/CodeCommit | ||
| * Retrieves Ansible playbooks and roles | ||
| * Fetches Goss testing suite | ||
|
|
||
| 3. **Build Stage** | ||
| * CodeBuild executes Packer with appropriate templates | ||
| * Launches EC2 instance with security groups and networking | ||
| * Retrieves secure credentials from Secrets Manager | ||
| * Manages SSH keys and access configurations | ||
|
|
||
| 4. **Configuration Stage** | ||
| * Ansible applies roles and configurations | ||
| * Installs required software and dependencies | ||
| * Configures system settings and services | ||
| * Handles registration with external services | ||
|
|
||
| 5. **AMI Creation** | ||
| * Packer creates AMI from configured instance | ||
| * Registers AMI with AWS | ||
| * Updates Parameter Store with AMI information | ||
| * Cleans up temporary resources | ||
|
|
||
| 6. **Testing Stage** | ||
| * Creates test instance from new AMI | ||
| * Deploys Goss test suite | ||
| * Executes validation tests | ||
| * Reports test results to pipeline | ||
|
|
||
| 7. **Completion** | ||
| * Success: AMI is ready for use, ID stored in Parameter Store | ||
| * Failure: AMI is deregistered, resources cleaned up | ||
| * Pipeline status updated with results | ||
|
|
||
| ## Usage Workflow | ||
|
|
||
| 1. Developers modify configuration code in any of the component repositories | ||
| 2. Changes trigger the pipeline through CodePipeline | ||
| 3. Pipeline executes build, configure, and test processes | ||
| 4. Resulting AMI is available through Parameter Store | ||
| 5. Users can create EC2 instances from Morpheus/Service Catalog using the new AMI | ||
|
|
||
| ## Security Features | ||
|
|
||
| * KMS encryption for artifacts and secrets | ||
| * IAM role-based access control | ||
| * Secure credential management through Secrets Manager | ||
| * Automated cleanup of temporary resources | ||
| * Secure network configurations for build processes |