

지원 종료 알림: 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="env-parameters"></a>

환경 인프라의 파라미터를 코드형 인프라(IaC) 파일로 정의하고 참조할 수 있습니다. AWS Proton 파라미터, 파라미터 유형, 파라미터 네임스페이스 및 IaC 파일에서 파라미터를 사용하는 방법에 대한 자세한 설명은 섹션을 참조하세요[AWS Proton 파라미터](parameters.md).

## 환경 파라미터를 정의하세요.
<a name="env-parameters.define"></a>

환경 IaC 파일의 입력 및 출력 파라미터를 모두 정의할 수 있습니다.
+ **입력 파라미터** — [스키마 파일](ag-schema.md)에 환경 입력 파라미터를 정의합니다.

  다음 목록에는 일반적인 사용 사례에 대한 환경 입력 파라미터의 예가 포함되어 있습니다.
  + VPC CIDR 값
  + 로드 밸런서 설정
  + 데이터베이스 설정
  + 상태 확인 타임아웃

  관리자는 [환경을 생성](ag-create-env.md)할 때 입력 파라미터 값을 제공할 수 있습니다.
  + 콘솔을 사용하여가 AWS Proton 제공하는 스키마 기반 양식을 작성합니다.
  + CLI를 사용하여 값이 포함된 사양을 제공하세요.
+ **출력 파라미터** - 환경 IaC 파일에서 환경 출력을 정의합니다. 그런 다음 다른 리소스의 IaC 파일에서 이러한 출력을 참조할 수 있습니다.

## 환경 IaC 파일에서 파라미터 값을 읽습니다.
<a name="env-parameters.refer"></a>

환경 IaC 파일에서 환경과 관련된 파라미터를 읽을 수 있습니다. IaC 파일에서 파라미터 값을 읽으려면 AWS Proton 파라미터 네임스페이스에 있는 파라미터 이름을 참조하세요.
+ **입력 파라미터** - `environment.inputs.{{input-name}}` 참조를 통해 환경 입력 값을 읽습니다.
+ **리소스 파라미터** -와 같은 이름을 참조하여 AWS Proton 리소스 파라미터를 읽습니다`environment.name`.

**참고**  
환경 IaC 파일에는 다른 리소스의 출력 파라미터를 사용할 수 없습니다.

## 파라미터가 포함된 예제 환경 및 서비스 IaC 파일
<a name="env-parameters.example"></a>

다음 예제는 환경 IaC 파일의 파라미터 정의 및 참조를 보여줍니다. 그런 다음 예제는 환경 IaC 파일에 정의된 환경 출력 파라미터를 서비스 IaC 파일에서 참조할 수 있는 방법을 보여줍니다.

**Example 환경 CloudFormation IaC 파일**  
이 예제에서는 다음 사항에 유의합니다.  
+ `environment.inputs.` 네임스페이스는 환경 입력 파라미터를 나타냅니다.
+ EC2 Systems Manager (SSM) `StoreInputValue` 파라미터는 환경 입력을 연결합니다.
+ `MyEnvParameterValue` 출력에는 출력 파라미터와 동일한 입력 파라미터 연결이 표시됩니다. 세 개의 추가 출력 파라미터도 입력 파라미터를 개별적으로 노출합니다.
+ 6개의 추가 출력 파라미터는 환경이 제공하는 리소스를 노출합니다.

```
Resources:
  StoreInputValue:
    Type: AWS::SSM::Parameter
    Properties:
      Type: String
      Value: "{{ environment.inputs.my_sample_input }} {{ environment.inputs.my_other_sample_input}} {{ environment.inputs.another_optional_input }}"
              # input parameter references

# These output values are available to service infrastructure as code files as outputs, when given the 
# the 'environment.outputs' namespace, for example, service_instance.environment.outputs.ClusterName.
Outputs:
  MyEnvParameterValue:                                        # output definition
    Value: !GetAtt StoreInputValue.Value
  MySampleInputValue:                                         # output definition
    Value: "{{ environment.inputs.my_sample_input }}"         #   input parameter reference
  MyOtherSampleInputValue:                                    # output definition
    Value: "{{ environment.inputs.my_other_sample_input }}"   #   input parameter reference
  AnotherOptionalInputValue:                                  # output definition
    Value: "{{ environment.inputs.another_optional_input }}"  #   input parameter reference
  ClusterName:                                                # output definition
    Description: The name of the ECS cluster
    Value: !Ref 'ECSCluster'                                  #   provisioned resource
  ECSTaskExecutionRole:                                       # output definition
    Description: The ARN of the ECS role
    Value: !GetAtt 'ECSTaskExecutionRole.Arn'                 #   provisioned resource
  VpcId:                                                      # output definition
    Description: The ID of the VPC that this stack is deployed in
    Value: !Ref 'VPC'                                         #   provisioned resource
  PublicSubnetOne:                                            # output definition
    Description: Public subnet one
    Value: !Ref 'PublicSubnetOne'                             #   provisioned resource
  PublicSubnetTwo:                                            # output definition
    Description: Public subnet two
    Value: !Ref 'PublicSubnetTwo'                             #   provisioned resource
  ContainerSecurityGroup:                                     # output definition
    Description: A security group used to allow Fargate containers to receive traffic
    Value: !Ref 'ContainerSecurityGroup'                      #   provisioned resource
```

**Example 서비스 클라우드포메이션 IAC 파일**  
`environment.outputs.` 네임스페이스는 환경 IaC 파일의 환경 출력을 나타냅니다. 예를 들어 이름 `environment.outputs.ClusterName`은 `ClusterName` 환경 출력 파라미터의 값을 읽습니다.  

```
AWSTemplateFormatVersion: '2010-09-09'
Description: Deploy a service on AWS Fargate, hosted in a public subnet, and accessible via a public load balancer.
Mappings:
  TaskSize:
    x-small:
      cpu: 256
      memory: 512
    small:
      cpu: 512
      memory: 1024
    medium:
      cpu: 1024
      memory: 2048
    large:
      cpu: 2048
      memory: 4096
    x-large:
      cpu: 4096
      memory: 8192
Resources:
  # A log group for storing the stdout logs from this service's containers
  LogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: '{{service_instance.name}}' # resource parameter

  # The task definition. This is a simple metadata description of what
  # container to run, and what resource requirements it has.
  TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      Family: '{{service_instance.name}}' # resource parameter
      Cpu: !FindInMap [TaskSize, {{service_instance.inputs.task_size}}, cpu] # input parameter
      Memory: !FindInMap [TaskSize, {{service_instance.inputs.task_size}}, memory] 
      NetworkMode: awsvpc
      RequiresCompatibilities:
        - FARGATE
      ExecutionRoleArn: '{{environment.outputs.ECSTaskExecutionRole}}'  # output reference to an environment infrastructure code file
      TaskRoleArn: !Ref "AWS::NoValue"
      ContainerDefinitions:
        - Name: '{{service_instance.name}}'  # resource parameter
          Cpu: !FindInMap [TaskSize, {{service_instance.inputs.task_size}}, cpu]
          Memory: !FindInMap [TaskSize, {{service_instance.inputs.task_size}}, memory]
          Image: '{{service_instance.inputs.image}}'
          PortMappings:
            - ContainerPort: '{{service_instance.inputs.port}}' # input parameter
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: '{{service_instance.name}}' # resource parameter
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: '{{service_instance.name}}' # resource parameter

  # The service_instance. The service is a resource which allows you to run multiple
  # copies of a type of task, and gather up their logs and metrics, as well
  # as monitor the number of running tasks and replace any that have crashed
  Service:
    Type: AWS::ECS::Service
    DependsOn: LoadBalancerRule
    Properties:
      ServiceName: '{{service_instance.name}}'  # resource parameter
      Cluster: '{{environment.outputs.ClusterName}}' # output reference to an environment infrastructure as code file
      LaunchType: FARGATE
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 75
      DesiredCount: '{{service_instance.inputs.desired_count}}'# input parameter
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: ENABLED
          SecurityGroups:
            - '{{environment.outputs.ContainerSecurityGroup}}' # output reference to an environment infrastructure as code file
          Subnets:
            - '{{environment.outputs.PublicSubnetOne}}' # output reference to an environment infrastructure as code file
            - '{{environment.outputs.PublicSubnetTwo}}' # output reference to an environment infrastructure as code file
      TaskDefinition: !Ref 'TaskDefinition'
      LoadBalancers:
        - ContainerName: '{{service_instance.name}}'  # resource parameter
          ContainerPort: '{{service_instance.inputs.port}}' # input parameter
          TargetGroupArn: !Ref 'TargetGroup'
[...]
```