AWS CICD
Welcome to the AWS CI/CD Components Docker Image Wiki!
Overview
This AWS CI/CD Docker image makes it easier to work with AWS in GitLab pipelines. It comes with ready-to-use bash scripts that handle AWS services like CloudFormation, EC2, S3, and Systems Manager (SSM). With this image, teams can manage AWS resources, trigger deployments, run EC2 commands, and more—directly from the pipeline.
It’s designed to work with the following CICD Components:
Core Concepts
Image Built for CI/CD
This Docker image is specifically built for CI/CD pipelines and includes common tools like the AWS CLI, session management, logging, and S3 file syncing. The goal is to simplify AWS interactions without needing to configure the AWS CLI each time.
CloudFormation Automation
CloudFormation allows you to define and manage AWS infrastructure as code. This image has scripts to automate deploying, updating, and deleting CloudFormation stacks. It validates templates, uploads them to S3, and monitors stack updates during deployment. If a stack already exists, it updates it instead of recreating it.
EC2 Commands via Systems Manager
The image comes with the AWS Session Manager Plugin, which lets you securely access EC2 instances via the command line without using SSH. It works with SSM to run commands or scripts, track progress, and handle tasks like configuration and patching.
Using AWS Systems Manager for this task makes the command execution secure and auditable, which is ideal for production environments where security is important, as it avoids the need to open SSH ports.
S3 File Syncing
This image makes syncing files to S3 easy. You can upload CloudFormation templates, scripts, or other files to S3, ensuring only necessary files are synced to keep the process fast and efficient.
AWS Credentials
The image is designed to handle AWS credentials securely using environment variables. If credentials are missing or incorrect, it will alert you to avoid errors. You can also manage multiple AWS profiles if needed within the same pipeline.
Logging and Debugging
The image provides detailed logs at different levels (info, warning, error, and debug) to help you understand what’s happening in the pipeline. If something goes wrong, the logs will show the issue right in the pipeline output, making it easier to troubleshoot.
Common Use Cases
Automated Infrastructure Provisioning
Teams that use infrastructure as code can use this image to manage CloudFormation stacks in GitLab pipelines. This ensures consistent and repeatable deployment of infrastructure.
Continuous Deployment with EC2
For deploying changes or running scripts on EC2 in a pipeline, this image works with SSM to do so without needing to manually SSH into instances.
Centralized File Storage for Deployments
When deploying with CloudFormation, it’s common to store templates and scripts in S3. This image automates syncing these files to S3, ensuring deployment assets are always available.
- Make sure that the IAM role attached to your EC2 instance has the necessary permissions to access objects in the specified S3 bucket.
Environment Variables and Configurations
Before using this CICD component, make sure these environment variables are set. The image includes a function to verify they are configured:
-
AWS_ACCESS_KEY_ID
/AWS_SECRET_ACCESS_KEY
: AWS credentials provided as environment variables for security. -
AWS_DEFAULT_REGION
: The AWS region where operations like CloudFormation deployments or EC2 management will take place.