

サポート終了通知: 2026 年 10 月 7 日、 AWS はサポートを終了します AWS Proton。2026 年 10 月 7 日以降、 AWS Proton コンソールまたは AWS Proton リソースにアクセスできなくなります。デプロイされたインフラストラクチャはそのまま残ります。詳細については、[AWS Proton 「サービス廃止と移行ガイド](https://docs.aws.amazon.com/proton/latest/userguide/proton-end-of-support.html)」を参照してください。

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

# サービス CloudFormation IaC ファイルパラメータの詳細と例
<a name="svc-parameters"></a>

パラメータは、あなたのサービスとパイプラインの Infrastructure as Code (IaC)ファイルで定義し、参照することができます。パラメータ、パラメータタイプ、 AWS Proton パラメータ名前空間、およびあなたの IaC ファイル内のパラメータの使用方法の詳細については、[AWS Proton パラメータ](parameters.md) を参照してください。

## サービスパラメータを定義する
<a name="svc-parameters.define"></a>

サービス IaC ファイルには、入力パラメータと出力パラメータの両方を定義できます。
+ **入力パラメータ** — サービスインスタンスの入力パラメータをあなたの[スキーマファイル](ag-schema.md)に定義します。

  以下に挙げるのは、一般的なユースケースのサービス入力パラメータの例です。
  + ポート
  + タスクサイズ
  + 画像
  + 必要数
  + Docker ファイル
  + ユニットテストコマンド

  [サービスを作成する](ag-create-svc.md)ときに、入力パラメータの値を指定できます。
  + コンソールを使用して、 AWS Proton が提供するスキーマベースのフォームに入力します。
  + 値を含む仕様を CLI で指定します。
+ **出力パラメータ** — あなたのサービス IaC ファイル内のサービスインスタンス出力を定義します。その後、他のリソースの IaC ファイルでこれらの出力を参照できます。

## サービス IaC ファイル内のパラメータ値を読み取ります。
<a name="svc-parameters.refer"></a>

サービス IaC ファイル内のサービスや他のリソースに関連するパラメータを読み取ることができます。パラメータ値を読み取るには、パラメータ名前空間で AWS Proton パラメータの名前を参照します。
+ **入力パラメータ** — `service_instance.inputs.{{input-name}}` を参照してサービスインスタンスの入力値を読み込む。
+ **リソースパラメータ** – `service.name`、、 などの名前を参照して`service_instance.name`リソース AWS Proton パラメータを読み取ります`environment.name`。
+ **出力パラメータ** — `environment.outputs.{{output-name}}` または `service_instance.components.default.outputs.{{output-name}}` を参照して他のリソースの出力を読み取ります。

## パラメータのあるサービス IaC ファイルの例
<a name="svc-parameters.example"></a>

次の例は、サービス CloudFormation IaC ファイルからのスニペットです。`environment.outputs.` 名前空間は、環境 IaC ファイルからの出力を参照します。`service_instance.inputs.` 名前空間はサービスインスタンスの入力パラメータを参照します。`service_instance.name` プロパティは、 AWS Proton リソースパラメータを参照します。

```
Resources:
  StoreServiceInstanceInputValue:
    Type: AWS::SSM::Parameter
    Properties:
      Type: String
      Value: "{{ service.name }} {{ service_instance.name }} {{ service_instance.inputs.my_sample_service_instance_required_input }} {{ service_instance.inputs.my_sample_service_instance_optional_input }} {{ environment.outputs.MySampleInputValue }} {{ environment.outputs.MyOtherSampleInputValue }}"
              #  resource parameter references               # input parameter references                                                                                                                    # output references to an environment infrastructure as code file
Outputs:
  MyServiceInstanceParameter:                                                         # output definition
    Value: !Ref StoreServiceInstanceInputValue 
  MyServiceInstanceRequiredInputValue:                                                # output definition
    Value: "{{ service_instance.inputs.my_sample_service_instance_required_input }}"  # input parameter reference
  MyServiceInstanceOptionalInputValue:                                                # output definition
    Value: "{{ service_instance.inputs.my_sample_service_instance_optional_input }}"  # input parameter reference
  MyServiceInstancesEnvironmentSampleOutputValue:                                     # output definition
    Value: "{{ environment.outputs.MySampleInputValue }}"                             # output reference to an environment IaC file
  MyServiceInstancesEnvironmentOtherSampleOutputValue:                                # output definition
    Value: "{{ environment.outputs.MyOtherSampleInputValue }}"                        # output reference to an environment IaC file
```