0Pricing
AWS for Backend Developers (EC2, S3, RDS, Lambda) · レッスン

CodeCommit と CodeBuild の基礎

CodeCommit でバージョン管理を設定し、CodeBuild を使ってプロジェクトのコードのコンパイルとテストを自動化します。

「CodeCommit と CodeBuild の基礎」はCoddyKit上の無料AWS for Backend Developers (EC2, S3, RDS, Lambda)レッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはAWS for Backend Developers (EC2, S3, RDS, Lambda)学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 AWS for Backend Developers (EC2, S3, RDS, Lambda)コースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

CI/CD on AWS: The Basics

Welcome to the world of Continuous Integration and Continuous Delivery (CI/CD) on AWS!

CI/CD is a set of practices that help developers deliver code changes more frequently and reliably. It involves automating the steps from code commit to deployment.

In this lesson, we'll explore two fundamental AWS services for CI/CD: CodeCommit for source control and CodeBuild for automated compilation and testing.

Meet AWS CodeCommit

AWS CodeCommit is a fully managed source control service that hosts secure Git-based repositories.

Think of it as AWS's version of GitHub or GitLab, but tightly integrated with other AWS services. It's designed for collaborative software development, allowing teams to store and manage their code securely.

CodeCommit's Core Capabilities

CodeCommit offers several key features:

  • Private Repositories: Host your code securely without public exposure.
  • Git Compatibility: Works seamlessly with standard Git clients and commands.
  • Collaboration: Supports branches, pull requests, and merge workflows for team development.
  • Security: Integrates with AWS Identity and Access Management (IAM) for fine-grained access control and encrypts your code at rest and in transit.

Creating a CodeCommit Repository

To start using CodeCommit, you first create a repository. This is where your project's code will live.

You can create a repository easily through the AWS Management Console, AWS CLI, or SDKs. Once created, you'll get a URL to clone it, just like any other Git repository.

Connecting to CodeCommit

After creating a repository, you'll want to clone it to your local machine to start coding. AWS CodeCommit uses Git credentials for authentication.

You can configure either HTTPS Git credentials or SSH keys to connect. This ensures only authorized users can push or pull code from your repository.

Here's how you might clone a repository locally:

git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyAwesomeApp

Introducing AWS CodeBuild

Now that your code is in CodeCommit, how do you build and test it automatically? That's where AWS CodeBuild comes in.

CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces deployable software packages. It eliminates the need to provision or scale your own build servers.

How CodeBuild Works

CodeBuild integrates with source providers like CodeCommit, S3, or GitHub. When triggered, it:

  1. Pulls your source code.
  2. Uses a buildspec file (a YAML file) to execute build commands.
  3. Generates build artifacts (e.g., compiled code, zip files).
  4. Uploads these artifacts to an S3 bucket.

It's an on-demand service, meaning you only pay for the compute time consumed.

Understanding the Buildspec File

The buildspec.yml file is the heart of your CodeBuild project. It's a YAML-formatted file that defines the commands and settings for your build process.

It typically includes different phases:

  • install: Install dependencies.
  • pre_build: Commands to run before the build.
  • build: The main build commands.
  • post_build: Commands to run after the build (e.g., run tests, package artifacts).

A Simple Buildspec Example

Here's what a basic buildspec.yml might look like for a simple application. This file tells CodeBuild what steps to take.

It defines the build environment, commands to execute in different phases, and what files to include in the output artifact.

version: 0.2

phases:
  install:
    commands:
      - echo Installing build dependencies...
      - # e.g., npm install
  build:
    commands:
      - echo Building the application...
      - # e.g., npm run build
  post_build:
    commands:
      - echo Running tests...
      - # e.g., npm test

artifacts:
  files:
    - '**/*'
  base-directory: 'dist'

Quick Check

Let's check your understanding of AWS CodeCommit and CodeBuild.

Lesson Summary

In this lesson, you've learned the basics of two core AWS services for CI/CD:

  • AWS CodeCommit: A managed Git service for secure, collaborative source control.
  • AWS CodeBuild: A fully managed service for compiling, testing, and packaging your code automatically.

These services form the foundation for automating your development pipeline on AWS, ensuring your code is version-controlled, built, and tested efficiently.

よくある質問

「CodeCommit と CodeBuild の基礎」レッスンは無料ですか?

はい。「CodeCommit と CodeBuild の基礎」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、AWS for Backend Developers (EC2, S3, RDS, Lambda)コースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 AWS for Backend Developers (EC2, S3, RDS, Lambda)コースには全4レッスンが含まれています。

「CodeCommit と CodeBuild の基礎」で何を学びますか?

CodeCommit でバージョン管理を設定し、CodeBuild を使ってプロジェクトのコードのコンパイルとテストを自動化します。 ブラウザで直接実行するハンズオンコードでAWS for Backend Developers (EC2, S3, RDS, Lambda)を演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

AWS for Backend Developers (EC2, S3, RDS, Lambda)を始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのAWS for Backend Developers (EC2, S3, RDS, Lambda)は初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「CodeCommit と CodeBuild の基礎」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このAWS for Backend Developers (EC2, S3, RDS, Lambda)レッスンでコードを書いて実行できますか?

はい。すべてのAWS for Backend Developers (EC2, S3, RDS, Lambda)レッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. CodeCommit と CodeBuild の基礎
  2. EC2/Lambda 向け CodeDeploy
  3. Serverless Application Model(SAM)
  4. CloudFormationによるInfrastructure as Code
← AWS for Backend Developers (EC2, S3, RDS, Lambda)に戻る