스키마 파일 - AWS Proton

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

스키마 파일

관리자는 Open API Data Models (스키마) 섹션을 사용하여 템플릿 번들에 대한 파라미터 스키마 YAML 파일을 정의하면 스키마에 정의한 요구 사항에 대해 파라미터 값 입력을 AWS Proton 검증할 수 있습니다.

형식 및 사용 가능한 키워드에 대한 자세한 내용은 OpenAPI의 스키마 개체 단원을 참조하세요.

환경 템플릿 번들에 대한 스키마 요구 사항

스키마는 OpenAPI의 YAML 형식의 데이터 모델 (스키마) 섹션을 따라야 합니다. 또한 환경 템플릿 번들의 일부여야 합니다.

환경 스키마의 경우 Open API의 데이터 모델 (스키마) 섹션을 사용하고 있음을 확인하기 위해 형식이 지정된 헤더를 포함해야 합니다. 다음 환경 스키마 예제에서 이러한 헤더는 처음 세 줄에 표시됩니다.

environment_input_type은 반드시 사용자가 제공한 이름과 함께 포함되고 정의되어야 합니다. 다음 예제에서는 5번 줄에 정의되어 있습니다. 이 파라미터를 정의하면 AWS Proton 환경 리소스에 연결할 수 있습니다.

Open API 스키마 모델을 따르려면 types을 포함해야 합니다. 다음 예제에서는 6번 줄입니다.

types 다음으로 environment_input_type 유형을 정의해야 합니다. 환경의 입력 파라미터를 environment_input_type의 속성으로 정의합니다. 환경 인프라에 스키마와 연결된 코드 (IaC) 파일로 나열된 하나 이상의 파라미터와 일치하는 이름을 가진 속성을 하나 이상 포함해야 합니다.

환경을 만들고 사용자 정의된 매개 변수 값을 제공하면 스키마 파일을 AWS Proton 사용하여 해당 매개 변수를 일치시키고 유효성을 검사한 다음 연관된 CloudFormation IAc 파일의 중괄호로 묶인 매개 변수에 삽입합니다. 각 속성(파라미터)에 대해 nametype를 입력합니다. 선택적으로 description, defaultpattern도 제공합니다.

다음 예제 표준 환경 템플릿 스키마의 정의된 파라미터에는 default 키워드 및 기본값과 함께 vpc_cidr, subnet_one_cidrsubnet_two_cidr이 포함됩니다. 이 환경 템플릿 번들 스키마를 사용하여 환경을 만들 때 기본값을 그대로 사용하거나 사용자 고유의 값을 제공할 수 있습니다. 파라미터가 기본값이 없고 required 속성(파라미터)으로 나열되어 있는 경우 환경을 만들 때 파라미터에 대한 값을 제공해야 합니다.

두 번째 예제 표준 환경 템플릿 스키마는 required 파라미터 my_other_sample_input을 나열합니다.

두 가지 환경 템플릿 유형에 대한 스키마를 생성할 수 있습니다. 자세한 내용은 템플릿 등록 및 게시 단원을 참조하세요.

  • 표준 환경 템플릿

    다음 예제에서는 환경 입력 유형이 설명과 입력 속성으로 정의됩니다. 이 스키마 예제는 예제 3에 표시된 AWS Proton CloudFormation IaC 파일과 함께 사용할 수 있습니다.

    표준 환경 템플릿의 예제 스키마:

    schema: # required format: # required openapi: "3.0.0" # required # required defined by administrator environment_input_type: "PublicEnvironmentInput" types: # required # defined by administrator PublicEnvironmentInput: type: object description: "Input properties for my environment" properties: vpc_cidr: # parameter type: string description: "This CIDR range for your VPC" default: 10.0.0.0/16 pattern: ([0-9]{1,3}\.){3}[0-9]{1,3}($|/(16|24)) subnet_one_cidr: # parameter type: string description: "The CIDR range for subnet one" default: 10.0.0.0/24 pattern: ([0-9]{1,3}\.){3}[0-9]{1,3}($|/(16|24)) subnet_two_cidr: # parameter type: string description: "The CIDR range for subnet one" default: 10.0.1.0/24 pattern: ([0-9]{1,3}\.){3}[0-9]{1,3}($|/(16|24))

    required 파라미터가 포함된 표준 환경 템플릿의 스키마 예시:

    schema: # required format: # required openapi: "3.0.0" # required # required defined by administrator environment_input_type: "MyEnvironmentInputType" types: # required # defined by administrator MyEnvironmentInputType: type: object description: "Input properties for my environment" properties: my_sample_input: # parameter type: string description: "This is a sample input" default: "hello world" my_other_sample_input: # parameter type: string description: "Another sample input" another_optional_input: # parameter type: string description: "Another optional input" default: "!" required: - my_other_sample_input
  • 고객 관리형 환경 템플릿

    다음 예제의 스키마에는 고객 관리형 인프라를 프로비저닝하는 데 사용한 IaC의 출력을 복제하는 출력 목록만 포함되어 있습니다. 출력 값 유형은 문자열로만 정의해야 합니다(목록, 배열 또는 기타 유형은 정의하지 않아야 함). 예를 들어, 다음 코드 스니펫은 외부 AWS CloudFormation 템플릿의 출력 섹션을 보여줍니다. 예제 1 에 표시된 템플릿에서 가져온 것입니다. 예제 4에서 만든 AWS Proton Fargate 서비스를 위한 외부 고객 관리 인프라를 생성하는 데 사용할 수 있습니다.

    중요

    관리자는 프로비저닝되고 관리되는 인프라와 모든 출력 매개변수가 관련 고객 관리 환경 템플릿과 호환되는지 확인해야 합니다. AWS Proton 변경 내용은 볼 수 없으므로 사용자를 대신하여 변경 내용을 설명할 수 없습니다. AWS Proton불일치로 인해 장애가 발생합니다.

    고객 관리형 환경 템플릿의 CloudFormation IaC 파일 출력 예:

    // Cloudformation Template Outputs [...] Outputs: ClusterName: Description: The name of the ECS cluster Value: !Ref 'ECSCluster' ECSTaskExecutionRole: Description: The ARN of the ECS role Value: !GetAtt 'ECSTaskExecutionRole.Arn' VpcId: Description: The ID of the VPC that this stack is deployed in Value: !Ref 'VPC' [...]

    해당 AWS Proton 고객 관리 환경 템플릿 번들의 스키마가 다음 예제에 나와 있습니다. 각 출력 값은 문자열로 정의됩니다.

    고객 관리형 환경 템플릿의 예제 스키마:

    schema: # required format: # required openapi: "3.0.0" # required # required defined by administrator environment_input_type: "EnvironmentOutput" types: # required # defined by administrator EnvironmentOutput: type: object description: "Outputs of the environment" properties: ClusterName: # parameter type: string description: "The name of the ECS cluster" ECSTaskExecutionRole: # parameter type: string description: "The ARN of the ECS role" VpcId: # parameter type: string description: "The ID of the VPC that this stack is deployed in" [...]

서비스 템플릿 번들에 대한 스키마 요구 사항

스키마는 다음 예시와 같이 YAML 형식의 OpenAPI의 데이터 모델(스키마) 섹션을 따라야 합니다. 서비스 템플릿 번들에 스키마 파일을 제공해야 합니다.

다음 서비스 스키마 예제에는 형식이 지정된 헤더를 포함해야 합니다. 다음 예제에서는 처음 세 줄에 해당합니다. 이는 Open API의 데이터 모델 (스키마) 섹션을 사용하고 있음을 확인하기 위한 것입니다.

service_input_type은 반드시 사용자가 제공한 이름과 함께 포함되고 정의되어야 합니다. 다음 예제에서는 5번 줄입니다. 이는 매개변수를 AWS Proton 서비스 리소스와 연결합니다.

콘솔 또는 CLI를 사용하여 서비스를 생성할 때 기본적으로 AWS Proton 서비스 파이프라인이 포함됩니다. 서비스에 대한 서비스 파이프라인을 포함할 때는 제공한 이름과 pipeline_input_type를 포함해야 합니다. 다음 예제에서는 7번 줄입니다. AWS Proton 서비스 파이프라인을 포함하지 않는 경우 이 파라미터를 포함하지 마세요. 자세한 설명은 템플릿 등록 및 게시 섹션을 참조하세요.

Open API 스키마 모델을 따르려면 types을 포함해야 합니다. 다음 예제에서는 9번째 줄에 있습니다.

types 다음으로 service_input_type 유형을 정의해야 합니다. 서비스의 입력 파라미터를 service_input_type의 속성으로 정의합니다. 스키마와 연결된 서비스 코드형 인프라(IaC) 파일에 나열된 하나 이상의 파라미터와 일치하는 이름의 속성을 하나 이상 포함해야 합니다.

서비스 파이프라인을 정의하려면 service_input_type 정의 아래에 pipeline_input_type를 정의해야 합니다. 스키마와 연결된 파이프라인 코드형 인프라(IaC) 파일에 나열된 하나 이상의 파라미터와 일치하는 이름의 속성을 하나 이상 포함해야 합니다. AWS Proton 서비스 파이프라인을 포함하지 않는 경우 이 정의를 포함하지 마세요.

관리자 또는 개발자가 서비스를 생성하고 사용자 지정된 매개변수 값을 제공할 때는 스키마 파일을 AWS Proton 사용하여 해당 값을 일치시키고 유효성을 검사한 다음 관련 CloudFormation IaC 파일의 중괄호로 묶인 매개 변수에 삽입합니다. 각 속성(파라미터)에 대해 nametype를 입력합니다. 선택적으로 description, defaultpattern도 제공합니다.

예제 스키마에 정의된 파라미터에는 키워드 및 기본값과 port, desired_count, task_size, imagedefault이 포함됩니다. 이 서비스 템플릿 번들 스키마를 사용하여 서비스를 만들 때 기본값을 사용하거나 고유한 값을 제공할 수 있습니다. 파라미터 unique_name도 예제에 포함되어 있으며 기본값이 없습니다. required 속성(파라미터)으로 나열됩니다. 관리자 또는 개발자는 서비스를 생성할 때 required 파라미터 값을 제공해야 합니다.

서비스 파이프라인이 포함된 서비스 템플릿을 생성하려면 스키마에 pipeline_input_type를 포함합니다.

서비스 파이프라인이 포함된 서비스의 서비스 스키마 파일 예시. AWS Proton

이 스키마 예제는 예제 4예제 5에 표시된 AWS Proton IaC 파일과 함께 사용할 수 있습니다. 서비스 파이프라인이 포함됩니다.

schema: # required format: # required openapi: "3.0.0" # required # required defined by administrator service_input_type: "LoadBalancedServiceInput" # only include if including AWS Proton service pipeline, defined by administrator pipeline_input_type: "PipelineInputs" types: # required # defined by administrator LoadBalancedServiceInput: type: object description: "Input properties for a loadbalanced Fargate service" properties: port: # parameter type: number description: "The port to route traffic to" default: 80 minimum: 0 maximum: 65535 desired_count: # parameter type: number description: "The default number of Fargate tasks you want running" default: 1 minimum: 1 task_size: # parameter type: string description: "The size of the task you want to run" enum: ["x-small", "small", "medium", "large", "x-large"] default: "x-small" image: # parameter type: string description: "The name/url of the container image" default: "public.ecr.aws/z9d2n7e1/nginx:1.19.5" minLength: 1 maxLength: 200 unique_name: # parameter type: string description: "The unique name of your service identifier. This will be used to name your log group, task definition and ECS service" minLength: 1 maxLength: 100 required: - unique_name # defined by administrator PipelineInputs: type: object description: "Pipeline input properties" properties: dockerfile: # parameter type: string description: "The location of the Dockerfile to build" default: "Dockerfile" minLength: 1 maxLength: 100 unit_test_command: # parameter type: string description: "The command to run to unit test the application code" default: "echo 'add your unit test command here'" minLength: 1 maxLength: 200

서비스 파이프라인 없이 서비스 템플릿을 만들려면 다음 예시와 같이 스키마에 pipeline_input_type를 포함하지 마십시오.

서비스 파이프라인이 포함되지 않은 AWS Proton 서비스의 서비스 스키마 파일 예시

schema: # required format: # required openapi: "3.0.0" # required # required defined by administrator service_input_type: "MyServiceInstanceInputType" types: # required # defined by administrator MyServiceInstanceInputType: type: object description: "Service instance input properties" required: - my_sample_service_instance_required_input properties: my_sample_service_instance_optional_input: # parameter type: string description: "This is a sample input" default: "hello world" my_sample_service_instance_required_input: # parameter type: string description: "Another sample input"