

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Elastic Beanstalk 環境との CI/CD 統合の実装
<a name="deployments.cicd"></a>

Elastic Beanstalk は、多くの CI/CD ツールと統合して、アプリケーション開発ワークフローを自動化します。CI/CD プラクティスを使用すると、最小限の手動による介入でアプリケーションを自動的に構築、テスト、デプロイできます。継続的デリバリー/デプロイ (CD) は、デプロイプロセスを自動化することで継続的インテグレーション (CI) を拡張します。CodePipeline などの AWS サービスや Jenkins や GitLab などのサードパーティーツールを使用して、合理化されたデプロイパイプラインを作成し、Elastic Beanstalk 環境への一貫した信頼性の高いデプロイを確保できます。

**Topics**
+ [AWS 開始する ソース](#deployments.cicd.aws-sites)
+ [その他のリソース](#deployments.cicd.aws-services.third-party)
+ [GitHub Actions を使用した Elastic Beanstalk へのデプロイ](deploying-github-actions.md)

## AWS 開始する ソース
<a name="deployments.cicd.aws-sites"></a>

次のリストでは、CI/CD ツールと、Elastic Beanstalk 環境への自動デプロイパイプラインを作成するためのstep-by-stepガイダンスを提供する対応する AWS リソースについて説明します。
+ **AWS CodePipeline** – この [AWS 入門リソースセンター](https://aws.amazon.com/getting-started/hands-on/continuous-deployment-pipeline/)チュートリアルでは、GitHub、S3、または AWS CodeCommitから Elastic Beanstalk への継続的デプロイパイプラインをセットアップする方法を示します。
+ **GitHub Actions** – GitHub から直接 Elastic Beanstalk への継続的なデプロイパイプラインをセットアップするように YAML ベースのワークフローを設定する[GitHub Actions を使用した Elastic Beanstalk へのデプロイ](deploying-github-actions.md)方法については、「」を参照してください。 GitHub
+ **GitLab** – この [AWS DevOps 開発者生産性ブログ](https://aws.amazon.com/blogs/devops/deploy-a-docker-application-on-aws-elastic-beanstalk-with-gitlab/)投稿では、Node.js アプリケーションを Elastic Beanstalk Docker 環境にデプロイするように GitLab 継続的パイプラインを設定する方法を示します。
+ **Azure DevOps** – この [.NET on AWS Blog](https://aws.amazon.com/blogs/dotnet/deploy-to-elastic-beanstalk-with-azure-devops/) の投稿では、Azure Pipelines を使用して、Azure DevOps Git リポジトリから Elastic Beanstalk への継続的なデプロイパイプラインを実装する方法について説明します。

## その他のリソース
<a name="deployments.cicd.aws-services.third-party"></a>

以下のサードパーティーのツールとリソースは、Elastic Beanstalk 環境に自動デプロイパイプラインを実装するのに役立ちます。
+ **Jenkins** – [AWS EBDeployment Jenkins プラグイン](https://plugins.jenkins.io/awseb-deployment-plugin/)を使用すると、Jenkins ジョブ設定ページから Elastic Beanstalk 環境に直接デプロイできます。
+ **Circle CI:** – [Orbs for Elastic Beanstalk](https://circleci.com/developer/orbs/orb/circleci/aws-elastic-beanstalk) は、アプリケーションを Elastic Beanstalk にデプロイおよびスケーリングするための再利用可能な設定パッケージを提供します。
+ **Bitbucket Pipelines** – 記事「[Bitbucket パイプラインを使用して Elastic Beanstalk アプリケーションをデプロイする](https://avishayil.medium.com/deploy-to-elastic-beanstalk-using-bitbucket-pipelines-189eb75cf052)」は、Elastic Beanstalk を使用して Bitbucket Pipelines を実装するための基本的な設定例を提供します。

# GitHub Actions を使用した Elastic Beanstalk へのデプロイ
<a name="deploying-github-actions"></a>

[GitHub Actions](https://docs.github.com/en/actions) は、コード変更をリポジトリにプッシュするときに、アプリケーションを Elastic Beanstalk に自動的にデプロイできます。[Elastic Beanstalk Deploy](https://github.com/aws-actions/aws-elasticbeanstalk-deploy) アクションは、アプリケーションバージョンの作成、Amazon S3 へのソースバンドルのアップロード、Elastic Beanstalk 環境へのデプロイを処理するシンプルな YAML インターフェイスを提供します。

## ワークフローの例
<a name="deploying-github-actions-example"></a>

次のワークフロー例では、`main`ブランチにプッシュするたびにアプリケーションを Elastic Beanstalk 環境にデプロイします。リポジトリの `.github/workflows/` に `.yml` ファイルを作成します。

**Example Elastic Beanstalk デプロイの GitHub Actions ワークフロー**  

```
name: Deploy to Elastic Beanstalk

on:
  push:
    branches:
      - main

permissions:
  id-token: write
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/my-github-actions-role
          aws-region: us-east-1

      - name: Deploy to Elastic Beanstalk
        uses: aws-actions/aws-elasticbeanstalk-deploy@v1.0.0
        with:
          aws-region: us-east-1
          application-name: my-application
          environment-name: my-application-env
```

このワークフローでは、リポジトリをチェックアウトし、[OpenID Connect (OIDC)](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services) を使用して[認証情報の設定 AWS](https://github.com/aws-actions/configure-aws-credentials)アクション AWS を通じて で認証してから、アプリケーションを Elastic Beanstalk にデプロイします。デプロイアクションは、リポジトリのコンテンツをパッケージ化し、ソースバンドルを Amazon S3 にアップロードし、新しいアプリケーションバージョンを作成し、環境を作成または更新します。デフォルトでは、デプロイが完了し、環境が正常な状態に戻るのを待ちます。

その他の設定オプションと詳細な例については、GitHub の[「Elastic Beanstalk Deploy action README](https://github.com/aws-actions/aws-elasticbeanstalk-deploy#readme)」を参照してください。

## その他のリソース
<a name="deploying-github-actions-resources"></a>
+ GitHub での [Elastic Beanstalk デプロイアクション](https://github.com/aws-actions/aws-elasticbeanstalk-deploy) 
+ GitHub [で AWS 認証情報アクションを設定する](https://github.com/aws-actions/configure-aws-credentials) 
+ [Configuring OpenID Connect in Amazon Web Services](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services) (GitHub ドキュメント)