

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

# ステップ 2. AWS Service Catalog 製品を作成する
<a name="step-2-create-blueprint-product"></a>

 AWS Service Catalog 製品を作成するには、「 *AWS Service Catalog 管理者ガイド*」の[「製品の作成](https://docs.aws.amazon.com//servicecatalog/latest/adminguide/productmgmt-cloudresource.html)」のステップに従います。 AWS Service Catalog 製品を作成するときに、アカウントのブループリントをテンプレートとして追加します。

**重要**  
HashiCorp が Terraform ライセンスを更新した結果、*Terraform Open Source* 製品とプロビジョニング済み製品のサポートが *External* という新しい製品タイプ AWS Service Catalog に変更されました。この変更が AFC に与える影響の詳細 (既存のアカウントのブループリントを External 製品タイプに更新する方法など) については、「[External 製品タイプへの移行](af-customization-page.md#service-catalog-external-product-type)」を参照してください。

**ブループリントを作成する手順の概要**
+ アカウントのブループリントとなる 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 リファレンスアーキテクチャリポジトリ CloudFormation からダウンロードできます。[そのリポジトリの例は、リソースのバックアッププランを設定するのに役立ちます](https://github.com/aws-samples/aws-service-catalog-reference-architectures/blob/master/backup/backup-tagoptions.yml)。

以下は、**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
```