

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

# 同期設定を作成する
<a name="syncconfigurations-create"></a>

 AWS Command Line Interface (AWS CLI) の **create-repository-link** コマンドを使用して、接続と同期する外部リポジトリ間のリンクを作成できます。

同期設定を作成する前に、接続とサードパーティーのリポジトリとの間にリポジトリリンクを作成しておく必要があります。

**同期設定を作成するには**

1. ターミナル (Linux/macOS/Unix) またはコマンドプロンプト (Windows) を開きます。 AWS CLI を使用して **create-repository-link** コマンドを実行します。関連する接続の ARN、所有者 ID、およびリポジトリ名を指定します。次のコマンドは、 CloudFormation内のリソースの同期タイプを使用して同期設定を作成します。また、リポジトリ内のリポジトリブランチと設定ファイルも指定します。この例では、リソースは **`mystack`** という名前のスタックです。

   ```
   aws codeconnections create-sync-configuration --branch main --config-file filename --repository-link-id be8f2017-b016-4a77-87b4-608054f70e77 --resource-name mystack --role-arn arn:aws:iam::{{account_id}}:role/myrole --sync-type CFN_STACK_SYNC
   ```

1. このコマンドで、以下の出力が返ります。

   ```
   {
       "SyncConfiguration": {
           "Branch": "main",
           "ConfigFile": "filename",
           "OwnerId": "{{account_id}}",
           "ProviderType": "GitHub",
           "RepositoryLinkId": "be8f2017-b016-4a77-87b4-608054f70e77",
           "RepositoryName": "MyRepo",
           "ResourceName": "mystack",
           "RoleArn": "arn:aws:iam::{{account_id}}:role/myrole",
           "SyncType": "CFN_STACK_SYNC"
       }
   ```