

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

# AWS CloudFormation を使用して Bitbucket リポジトリを AWS Amplify と統合する
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation"></a>

*Amazon Web Services、Alwin Abraham*

## 概要
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation-summary"></a>

AWS Amplify を使用すると、通常必要なインフラストラクチャをセットアップしなくても、静的ウェブサイトを迅速にデプロイしてテストできます。既存のアプリケーションコードを移行する場合でも、新しいアプリケーションを構築する場合でも、組織が Bitbucket をソース管理に使用したい場合は、このパターンのアプローチを導入できます。AWS CloudFormation を使用して Amplify を自動的にセットアップすることで、使用している設定を可視化できます。

AWS CloudFormation を使用して Bitbucket リポジトリを AWS Amplify と統合することで、フロントエンド CI/CD パイプラインとデプロイ環境を作成します。このパターンのアプローチは、反復可能なデプロイメントのためのAmplify フロントエンドパイプラインを構築できることを意味します。

## 前提条件と制限事項
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation-prereqs"></a>

前提条件
+ Amazon Web Services (AWS) (AWS) アカウント。
+ 管理者アクセス権を持つアクティブな Bitbucket アカウント
+ 「[cURL](https://curl.se/)」または「[Postman](https://www.postman.com/)」アプリケーションを使用する端末へのアクセス
+ Amplify Gurify の使用方法
+ AWS CloudFormation に精通している
+ YAML 形式のファイルに精通していること

## アーキテクチャ
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation-architecture"></a>

![\[Diagram showing user interaction with Bitbucket repository connected to AWS Amplify in AWS クラウド region.\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/images/pattern-img/24ae87ed-aa5d-4114-9c5d-bdcb4d40a78b/images/25d73a9d-d2ae-40bc-9ebc-57f9bd13884a.png)


**テクノロジースタック**
+ Amplify
+ AWS CloudFormation
+ Bitbucket

## ツール
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation-tools"></a>
+ [AWS Amplify](https://docs.aws.amazon.com/amplify/) — Amplify は、開発者がクラウドを利用したモバイルアプリやウェブアプリを開発およびデプロイするのに役立ちます。
+ [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html) – AWS CloudFormation は AWS リソースのモデル化とセットアップに役立つサービスです。リソース管理に割く時間を減らし、AWS で実行するアプリケーションにより注力できるようになります。
+ [Bitbucket](https://bitbucket.org/) — Bitbucket は、プロフェッショナルチーム向けに設計された Git リポジトリ管理ソリューションです。Git リポジトリの管理、ソースコードの共同編集、開発フローのガイドなどを一元的に行えます。

 

**コード**

`bitbucket-amplify.yml`ファイル (添付) には、このパターンの AWS CloudFormation テンプレートが含まれています。

## エピック
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation-epics"></a>

### Bitbucket リポジトリを設定します。
<a name="configure-the-bitbucket-repository"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| (オプション) Bitbucket リポジトリを作成します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html)既存の Bitbucket リポジトリを使用することもできます。 | DevOps エンジニア | 
| ワークスペース設定を開きます。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html) | DevOps エンジニア | 
| OAuth コンシューマーを作成します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html) | DevOps エンジニア | 
| OAuth アクセストークンを取得します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html)`curl -X POST -u "KEY:SECRET" https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials ``KEY` と `SECRET` を先ほど記録したキーとシークレットに置き換えます。 2. 引用符を使わずにアクセストークンを記録します。トークンの有効期間は限られており、デフォルトは 2 時間です。この期間内に AWS CloudFormation テンプレートを実行する必要があります。 | DevOps エンジニア | 

### AWS CloudFormation スタックの設定とデプロイ
<a name="create-and-deploy-the-aws-cloudformation-stack"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
|  AWS CloudFormation のテンプレートをダウンロードします。 | `bitbucket-amplify.yml`AWS CloudFormation のテンプレートをダウンロードします。このテンプレートは、Amplify プロジェクトとブランチに加えて、AAmplify でCI/CDパイプラインを作成します。 |  | 
| AWS CloudFormation スタックの設定とデプロイ | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html)5. [**次へ**] を選択してから、[**スタックの作成**] を選択します。 | DevOps エンジニア | 

### CI/CD パイプラインをテストする
<a name="test-the-ci-cd-pipeline"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| コードをリポジトリのブランチにデプロイします。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html)このコマンドの詳細については、Ｂｉｔｂｕｋｅｃｔドキュメントの「[基本の Git コマンド](https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html)」を参照してください。  | アプリ開発者 | 

## 関連リソース
<a name="integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation-resources"></a>

[認証方法](https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication) (アトラシアン製品ドキュメント)

## アタッチメント
<a name="attachments-24ae87ed-aa5d-4114-9c5d-bdcb4d40a78b"></a>

このドキュメントに関連する追加コンテンツにアクセスするには、次のファイルを解凍してください。「[attachment.zip](samples/p-attach/24ae87ed-aa5d-4114-9c5d-bdcb4d40a78b/attachments/attachment.zip)」