Supercharge Your Software Delivery with AWS CI/CD ๐Ÿ› ๏ธ


๐Ÿ‘€ 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

We teach AWS for the real world - not for certifications. Join more than 10,500 developers learning how to build real-world applications on AWS.

Read more from AWS for the Real World

AWS FOR THE REAL WORLD โฑ๏ธ Reading time: 17 minutes ๐ŸŽฏ Main Learning: How to build a secure, scalable AWS landing zone using AWS Organizations, Service Control Policies, and Identity Center for centralized account and user management. ๐Ÿ“ Blog Post Hey Reader ๐Ÿ‘‹๐ŸฝToday I want to dig into how to set up a proper AWS landing zone. Weโ€™ll be chatting about AWS Organizations, Service Control Policies (SCPs), and Identity Center. These are the core tools I reach for when I need to get accounts organized,...

AWS FOR THE REAL WORLD โฑ๏ธ Reading time: 15 minutes ๐ŸŽฏ Main Learning: How to build an automated related posts feature by leveraging Bedrock Knowledge Bases and Amazon S3 Vectors for content discovery. ๐Ÿ“ Blog Post Hey Reader ๐Ÿ‘‹๐ŸฝEver wanted to show folks โ€œrelated postsโ€ but didnโ€™t want to build your own search from scratch? Weโ€™ve been playing with Bedrock Knowledgebases and S3 vectors, and turns out, it makes that job way easier than expected.Weโ€™ll go over how you can use these tools to connect...

AWS FOR THE REAL WORLD โฑ๏ธ Reading time: 8 minutes ๐ŸŽฏ Main Learning: How to automatically generate professional AWS architecture diagrams using Amazon Q with MCP servers ๐Ÿ“ Blog Post Hey Reader ๐Ÿ‘‹๐ŸฝLetโ€™s talk about saving money on AWS. Cost surprises are no funโ€”especially for folks just starting out. AWS pricing looks easy at first, but there are so many little things that can trip you up if youโ€™re not careful.Today Iโ€™m breaking down a few simple tips that actually work for beginners. Letโ€™s jump...