

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

# を使用したリージョン間ピアリングの設定を自動化する AWS Transit Gateway
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway"></a>

*Ram Kandaswamy (Amazon Web Services)*

## 概要
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway-summary"></a>

[AWS Transit Gateway](https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html) は、中央ハブを介して仮想プライベートクラウド (VPCs) とオンプレミスネットワークを接続します。Transit Gateway トラフィックはパブリックインターネットを経由しないため、一般的なエクスプロイトや分散型サービス拒否 (DDoS) 攻撃などの脅威ベクトルが軽減されます。

2 つ以上の 間で通信する必要がある場合は AWS リージョン、リージョン間 Transit Gateway ピアリングを使用して、異なるリージョンの Transit Gateway 間でピアリング接続を確立できます。ただし、Transit Gateway とのリージョン間ピアリングを手動で設定すると、複雑で時間がかかる場合があります。このパターンは、Infrastructure as Code (IaC) を使用してピアリングをセットアップするためのガイダンスを提供します。このアプローチは、複数のリージョンを繰り返し設定する必要がある場合や、マルチリージョンの組織設定 AWS アカウント に使用することができます。

このパターンは、Amazon CloudWatch Logs の AWS Step Functions [ワークフロー](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-statemachines.html)、関数、 AWS Identity and Access Management (IAM) [ロール](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)、[ロググループ](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html)を含む [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)スタックを設定します。 AWS Lambda [https://docs.aws.amazon.com/lambda/latest/dg/concepts-basics.html#gettingstarted-concepts-function](https://docs.aws.amazon.com/lambda/latest/dg/concepts-basics.html#gettingstarted-concepts-function)次に、Step Functions ワークフローを実行して、トランジットゲートウェイのリージョン間ピアリング接続を作成します。

## 前提条件と制限事項
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway-prereqs"></a>

**前提条件**
+ アクティブ AWS アカウント。
+ [Kiro](https://kiro.dev/#what-is-kiro) などのコード生成機能を持つ IDE。
+ Amazon Simple Storage Service (Amazon S3) バケットとそのバケットにオブジェクトをアップロードするためのアクセス許可。
+ リクエスト元のリージョンと受け入れ先のリージョンで作成されたトランジットゲートウェイ。
+ リクエスト元のリージョンと受け入れ先のリージョンで作成された VPCs。VPCsを持つ `addToTransitGateway`キーをタグ付けします`true`。
+ 要件に従って VPCs 用に設定された[セキュリティグループ](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html)。
+ 要件に従って VPCs 用に設定された[ネットワークアクセスコントロールリスト (ACLs)](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html)。

**制限事項**
+ 一部の のみがリージョン間ピアリング AWS リージョン をサポートしています。リージョン間ピアリングをサポートするリージョンの完全なリストについては、[AWS Transit Gateway FAQs](https://aws.amazon.com/transit-gateway/faqs/)を参照してください。

## アーキテクチャ
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway-architecture"></a>

 このパターンで説明されているエージェント AI 開発アプローチには、次のステップが含まれます。

1. **自動化プロンプトを定義する** – Kiro は、ピアリング要件の詳細を示す自然言語プロンプトを受け取ります。

1. **自動化スクリプトの生成** – Kiro は、提供されたプロンプトに基づいて CloudFormation スクリプトと Lambda スクリプトを生成します。

1. **スタックをデプロイ**する – Kiro は CloudFormation を使用して必要なリソースをデプロイします。

1. **ピアリングの設定** – Kiro は Step Functions ワークフローを実行します。このワークフローは Lambda 関数を呼び出してピアリング接続を作成し、ルートテーブルを変更します。

次の図は、Step Functions ワークフローを示しています。

![\[トランジットゲートウェイピアリング用の Lambda 関数を呼び出すための Step Function ワークフロー。\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/images/pattern-img/b678bb87-c7b9-4f7b-b26e-eaac650e5d1b/images/2f235f47-5d68-492c-b954-7dc170939cae.png)


 

ワークフローの主なステップは、次のとおりです。

1. Step Functions ワークフローは、Transit Gateway ピアリングの Lambda 関数を呼び出します。 

1. ワークフローは 1 分間待機します。

1. ワークフローはピアリングステータスを取得し、条件ブロックに送信します。ブロックがルーピングを実行します。 

1. 成功条件が満たされない場合、ワークフローはタイマーステージに移行するようにコーディングされます。 

1. 成功条件が満たされた場合、Lambda 関数はルートテーブルを変更します。

1. Step Functions ワークフローは終了します。

## ツール
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway-tools"></a>
+ [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html) は、 AWS リソースをセットアップし、迅速かつ一貫してプロビジョニングし、 AWS アカウント および 全体のライフサイクルを通じてリソースを管理するのに役立ちます AWS リージョン。 
+ [Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html) を使用すると、すべてのシステム、アプリケーション、および からのログを一元化 AWS のサービス できるため、ログをモニタリングして安全にアーカイブできます。
+ [AWS Identity and Access Management](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)[ (](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)[IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)[)](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) は、リソースの使用を認証および認可されたユーザーを制御することで、 AWS リソースへのアクセスを安全に管理できます。
+ [Kiro](https://kiro.dev/#what-is-kiro) は、スペック駆動型開発を通じて本番環境対応のアプリケーションを構築するのに役立つエージェント AI 開発ツールです。 
+ [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html) は、サーバーのプロビジョニングや管理を行うことなくコードを実行できるコンピューティングサービスです。必要に応じてコードを実行し、自動的にスケーリングするため、課金は実際に使用したコンピューティング時間に対してのみ発生します。
+ [AWS Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) は、 AWS Lambda 関数やその他の を組み合わせてビジネスクリティカルなアプリケーション AWS のサービス を構築するのに役立つサーバーレスオーケストレーションサービスです。  

## エピック
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway-epics"></a>

### Lambda および Step Functions コードを生成する
<a name="generate-lam-and-sfn-code"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| プロンプトプレースホルダーに特定の詳細を入力する | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-the-setup-of-inter-region-peering-with-aws-transit-gateway.html)または、ファイルをコンテキストにアタッチせずに、上記の変数を参照するインラインプロンプトとして追加することもできます。 | AWS 全般、ネットワーク管理者 | 
| ピアリングアタッチメントを作成する Lambda 関数を作成します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-the-setup-of-inter-region-peering-with-aws-transit-gateway.html) | AWS 全般、ネットワーク管理者、プロンプトエンジニアリング | 
| ピアリングアタッチメントのステータスをポーリングする Lambda 関数を作成します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-the-setup-of-inter-region-peering-with-aws-transit-gateway.html) | AWS 全般、ネットワーク管理者、プロンプトエンジニアリング | 
| 両方のリージョンに静的ルートを追加する Lambda 関数を作成します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-the-setup-of-inter-region-peering-with-aws-transit-gateway.html) | AWS 全般、ネットワーク管理者 | 
| CloudFormation テンプレートを作成します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-the-setup-of-inter-region-peering-with-aws-transit-gateway.html) | AWS DevOps、AWS 全般、プロンプトエンジニアリング | 

### AWS リソースをデプロイする
<a name="deploy-the-aws-resources"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| プロンプトを使用して CloudFormation スタックをデプロイします。 | 次のプロンプトを入力します。<pre>Using the outputs from Prompts 1-4, package and deploy the full stack. Steps:<br /><br />1. For each of the three Python files from Prompts 1-3, create a zip named after the file (e.g. peer-transit-gateway.zip that contains peer-transit-gateway.py).<br />2. Upload all three zips to S3_BUCKET.<br />3. Deploy the CloudFormation template from Prompt 4 to ACTIVE_REGION with S3BucketName=S3_BUCKET and CAPABILITY_NAMED_IAM.<br />4. Initiate the Step Function from the deployed stack.<br /><br />Zip file names must match the S3Key values in the template exactly.</pre> | AWS DevOps、クラウド管理者、AWS 全般、プロンプトエンジニアリング | 
| デプロイを検証します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-the-setup-of-inter-region-peering-with-aws-transit-gateway.html) | AWS 全般 | 

## 関連リソース
<a name="automate-the-setup-of-inter-region-peering-with-aws-transit-gateway-resources"></a>
+ [Step Functions でステートマシンの実行を開始する](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-executions.html)
+ [Transit Gateway ピアリングアタッチメント](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-peering.html)
+ [AWS リージョン を使用した 間の VPCs相互接続 AWS Transit Gateway](https://www.youtube.com/watch?v=cj1rQqLxXU8) (ビデオ)