翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
ステップ 2. AWS Service Catalog 製品を作成する
AWS Service Catalog 製品を作成するには、「 AWS Service Catalog 管理者ガイド」の「製品の作成」の手順に従います。 AWS Service Catalog 製品を作成するときに、アカウントのブループリントをテンプレートとして追加します。
重要
HashiCorp が Terraform ライセンスを更新した結果、Terraform Open Source 製品とプロビジョニング済み製品のサポートが External という新しい製品タイプ AWS Service Catalog に変更されました。この変更が AFC に与える影響の詳細 (既存のアカウントのブループリントを External 製品タイプに更新する方法など) については、「External 製品タイプへの移行」を参照してください。
ブループリントを作成する手順の概要
-
アカウントのブループリントとなる AWS CloudFormation テンプレートまたは Terraform tar.gz 設定ファイルを作成またはダウンロードします。いくつかのテンプレートの例については、このセクションの後半に示します。
-
Account Factory ブループリント AWS アカウント を保存する にサインインします (ハブアカウントと呼ばれることもあります)。
-
AWS Service Catalog コンソールに移動します。次に、[Product list] (製品リスト) を選択し、[Upload new product] (新しい製品をアップロード) を選択します。
-
[Product details] (製品詳細) ペインに、名前や説明など、ブループリント製品の詳細を入力します。
-
[Use a template file] (テンプレートファイルの使用)、[Choose file] (ファイルの選択) の順に選択します。ブループリントとして使用するために作成またはダウンロードしたテンプレートや設定ファイルを選択または貼り付けます。
-
コンソールページの下部にある [Create product] (製品を作成する) を選択します。
テンプレートは、 AWS Service Catalog リファレンスアーキテクチャリポジトリ AWS CloudFormation からダウンロードできます。そのリポジトリの例は、リソースのバックアッププランを設定するのに役立ちます
以下は、Best Pets という架空の会社向けのテンプレートの例です。これは、ペットのデータベースへの接続を設定するのに役立ちます。
Resources: ConnectionStringGeneratorLambdaRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Principal: Service: - lambda.amazonaws.com Action: - "sts:AssumeRole" ConnectionStringGeneratorLambda: Type: AWS::Lambda::Function Properties: FunctionName: !Join ['-', ['ConnectionStringGenerator', !Select [4, !Split ['-', !Select [2, !Split ['/', !Ref AWS::StackId]]]]]] Description: Retrieves the connection string for this account to access the Pet Database Role: !GetAtt ConnectionStringGeneratorLambdaRole.Arn Runtime: nodejs22.x Handler: index.handler Timeout: 5 Code: ZipFile: > export const handler = async (event, context) => { const awsAccountId = context.invokedFunctionArn.split(“:”)[4] const connectionString= “fake connection for account ” + awsAccountId; const response = { statusCode: 200, body: connectionString }; return response; }; ConnectionString: Type: Custom::ConnectionStringGenerator Properties: ServiceToken: !GetAtt ConnectionStringGeneratorLambda.Arn PetDatabaseConnectionString: DependsOn: ConnectionString # For example purposes we're using SSM parameter store. # In your template, use secure alternatives to store # sensitive values such as connection strings. Type: AWS::SSM::Parameter Properties: Name: pet-database-connection-string Description: Connection information for the BestPets pet database Type: String Value: !GetAtt ConnectionString.Value