Deploy to AWS S3
このガイドでは、Bitbucket Pipelines で aws-s3-deploy パイプを使用して AWS S3 バケットにファイルをデプロイする方法を説明します。
前提条件:
デプロイメント アーティファクトがコピーされる AWS S3 バケットをセットアップしていること。
AWS S3 バケットへのアーティファクトのアップロードを行うための十分な権限が構成されている IAM ユーザー。
手順
Add your AWS credentials to Bitbucket Pipelines. In your repository, go to Repository settings, under Pipelines, select Repository variables and add the following variables. Learn more on how to configure Pipelines variables.
Basic usage variablesAWS_ACCESS_KEY_ID (*): ご利用の AWS アクセス キー。
AWS_SECRET_ACCESS_KEY (*): ご利用の AWS シークレット アクセス キー。保護された変数として保存する必要があります。
AWS_DEFAULT_REGION (*): AWS リソースを含むリージョンの AWS リージョン コード (us-east-1、us-west-2 など)。詳細については、AWS リソースを含むリージョンの AWS リージョン コード (us-east-1、us-west-2 など) を参照してください。詳細については「リージョンとエンドポイント」を確認してください。
CI/CD 構成をセットアップします。
例image: atlassian/default-image:2 pipelines: default: - step: name: Build artifact script: - mkdir artifact - echo "Pipelines is awesome!" > artifact/index.html artifacts: - artifact/* - step: name: Deploy to S3 deployment: production script: - pipe: atlassian/aws-s3-deploy:0.3.8 variables: AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION: 'us-east-1' S3_BUCKET: 'bbci-example-s3-deploy' LOCAL_PATH: 'artifact' ACL: 'public-read'
注: aws-s3-deploy パイプ を他のパイプと組み合わせて、独自の CI/CD を作成できます。
Deploy the application to production. Push your application’s code to your Bitbucket repository which will trigger the pipeline. You can then select Pipelines to check the progress of the pipeline.
Now you can validate your files in the S3 bucket and focus on building your great application, everything else is handled by Bitbucket Pipelines.
Pipelines とパイプを使用した自身の AWS S3 バケットへのデプロイをハンズオンで確認したい場合、このサンプル リポジトリで完全なエンドツーエンドのサンプルを利用できます。
この内容はお役に立ちましたか?