Supercharge Your Software Delivery with AWS CI/CD πŸ› οΈ

published2 months ago
4 min read

πŸ‘€ This is not properly displayed? Here is the online version! πŸ’‘

Hi Reader πŸ‘‹πŸ½

A continuous integration and delivery system (CI/CD) is a must-have for developers because it automates the process of merging code changes, running tests, and deploying applications, ensuring faster and more reliable software releases.

It also helps identify and fix issues early on, leading to improved collaboration and overall development efficiency.

In this issue, we want to talk about AWS CodeBuild & CodePipeline, the fully-managed CI/CD services by AWS.

Let's dive into it!

​

CodeBuild & CodePipeline Infographic

Excited to learn the basics? Explore our infographics that cover everything you need to know to get started with AWS's managed continuous integration & delivery services.

​

Reliable Application Releases

Compiling applications usually requires a πŸ€– specific environment that offers all the necessary tools, languages, and frameworks that are part of the build process.

Additionally, you want to πŸ—οΈ regularly deploy changes to your application or product to ensure that the current development version available for internal or external testing doesn’t differ too much from the latest state of development. And surely, it passes regressions and therefore doesn't break existing features.

Thirdly, even a small team of developers is usually very diverse, not only from a cultural perspective but also from a technical point of view. Everyone has their own preferences for πŸ› οΈ development tools or even operating systems.

We also want to decouple the development process from the release process and πŸ” restrict manual production access by developers and team members. This is important to avoid human error. It’s often necessary to fulfill compliance requirements that may apply in a given country.

Lastly, in cases of issues, we want to be able to 🟒 easily roll back to a previous version to restore a healthy application state.

This can be summarized as follows: We need a dedicated development environment with a reliable set of tools that can run automatically and securely, without any human intervention.

This is precisely what continuous integration and delivery services, such as AWS CodeBuild and CodePipeline, are designed for.

​

Building Applications and Managing Infrastructure

AWS CodeBuild is not limited to just building applications. It can also handle tasks like infrastructure manipulations, modifying routing destinations, creating backups, triggering Lambda functions, and running any other scripted process. Since CodeBuild can run any container image, it has no limitations on the types of tasks it can handle.

A well-structured delivery process involves coordinating multiple jobs for reliable and secure code or infrastructure deployment. AWS CodePipeline serves as the orchestration tool for CodeBuild, allowing you to create pipelines that connect jobs into stages. This enables you to establish a replicable and comprehensible multi-step rollout process.

Key Terms

To understand how CodeBuild and CodePipeline work, we need to review their key terms and fundamentals.

  • πŸ—οΈ Build Images & Containers: Builds in AWS CodeBuild are executed within containers. You can either provide your own image or use one of the managed images provided by AWS, which already includes the necessary runtimes for most programming languages.
  • πŸ“ Build Specs: build spec files are used to define the actions and settings for a build job. These files are written in YAML format and can be provided either in the source code or when creating a build project.
  • πŸ”€ Phases: Phases in CodeBuild represent the different stages or steps in the build process, allowing developers to define and customize specific actions and commands for each phase in the build spec file.
  • πŸ‘©β€πŸ’» Sources: CodeBuild supports multiple source providers such as Amazon S3, AWS CodeCommit, GitHub, and BitBucket. It allows you to check out a repository at the beginning of a build. You can also configure automatic triggering of builds on source changes, like new commits to a specific branch.
  • πŸ€– Pipelines: Organize your jobs and coordinate them into sequential or simultaneous actions.
  • πŸ“¦ Outputs: At the end of a build project execution, you have the option to archive artifacts, which are the outputs of the project. These artifacts are saved in S3 and can be used as inputs for other build projects in your pipeline. CodePipeline manages the versioning of these artifacts, ensuring that the latest version is always used in subsequent pipeline executions.

Defining the Job's Tasks

As mentioned before, the build specs define the tasks and requirements of a job. Build specs can be divided into multiple phases to effectively plan and execute the job.

Let's have a look at an example:

As seen, besides running our build commands, archiving our distribution package, and caching our dependencies, we're also able to easily access parameters and secrets via the SSM Parameter Store or the AWS Secrets Manager.

Creating a Structured Process with Quality Gates via Pipelines

We learned that pipelines are a coordinated set of build projects.

They enable the organization of continuous integration and deployment into stages, which include builds, quality checks, and actual deployments.

​

Monitoring of our Pipelines

Your CodeBuild and CodePipeline projects perform the most important actions in your AWS account. Therefore, monitoring is essential, just like it is for any other resource.

  • πŸ”Ž Logging: By default, all console output in CodeBuild is sent to CloudWatch if the necessary permissions are assigned to the service roles. This ensures that build projects can be traced if they fail.
  • 🚨 Build Notifications: AWS CodePipeline integrates with AWS Chatbot, which enables you to receive clear and easy-to-understand notifications through your preferred communication tools, such as Slack.

You can also customize the events for which you receive notifications. For example, you may choose to only be notified for failures.

Advantages & Downsides

Both CodeBuild and CodePipeline have several strengths.

  • πŸ’Έ Pay-as-you-go pricing - You’ll only pay for the resources you use, making it cost-effective for projects that don’t require continuous builds.
  • πŸ” Fully managed - These services are fully taken care of by AWS, so you don’t have to worry about maintenance.
  • 🟒 Highly available - Both services offer reliable performance and compensate for any downtime with service credits.

But there are also some downsides of AWS CodeBuild and CodePipeline, including:

  • provisioning of containers and infrastructure can add significant build time which you are charged for.
  • The console interfaces are criticized for being unintuitive and lacking clear organization.
  • On-demand pricing can be expensive for projects that require constant builds.
  • Additionally, using self-maintained container images can increase operational costs.

There's always a common saying that "the grass is always greener on the other side", but nonetheless, AWS CodeBuild and CodePipeline excel and are suitable options for almost any requirement.

​

You've made it to the end of this newsletter! πŸŽ‰
Thank you for reading! 🧑

Have a great week!

Sandro & Tobi


Still hungry for AWS content? Have a look at our blog! πŸ“š ↓

​

AWS for the Real World

Join our community of over 8,500 readers delving into AWS. We highlight real-world best practices through easy-to-understand visualizations and one-pagers. Expect a fresh newsletter edition every two weeks.

Read more from AWS for the Real World