다음 AWS CLI 예제 명령 및 응답에 표시된 대로 편집된 spec
로 서비스 인스턴스를 추가 및 삭제합니다.
CLI를 사용할 때는 spec
이 삭제할 서비스 인스턴스를 제외하고 추가할 서비스 인스턴스와 삭제 대상으로 표시하지 않은 기존 서비스 인스턴스를 모두 포함해야 합니다.
다음 목록은 편집 전 예제 spec
와 사양별로 배포된 서비스 인스턴스 목록을 보여줍니다. 이 사양은 이전 예제에서 서비스 설명을 편집하는 데 사용되었습니다.
Spec:
proton: ServiceSpec
pipeline:
my_sample_pipeline_optional_input: "abc"
my_sample_pipeline_required_input: "123"
instances:
- name: "my-instance"
environment: "simple-env"
spec:
my_sample_service_instance_optional_input: "def"
my_sample_service_instance_required_input: "456"
- name: "my-other-instance"
environment: "simple-env"
spec:
my_sample_service_instance_required_input: "789"
다음 예제 CLI list-service-instances
명령 및 응답은 서비스 인스턴스를 추가 또는 삭제하기 전의 활성 인스턴스를 보여줍니다.
명령:
$
aws proton list-service-instances \
--service-name "MySimpleService
"
응답:
{
"serviceInstances": [
{
"arn": "arn:aws:proton:region-id:123456789012:service/MySimpleService/service-instance/my-other-instance",
"createdAt": "2021-03-12T22:39:42.318000+00:00",
"deploymentStatus": "SUCCEEDED",
"environmentName": "simple-env",
"lastDeploymentAttemptedAt": "2021-03-12T22:39:43.109000+00:00",
"lastDeploymentSucceededAt": "2021-03-12T22:39:43.109000+00:00",
"name": "my-other-instance",
"serviceName": "example-svc",
"templateMajorVersion": "1",
"templateMinorVersion": "0",
"templateName": "fargate-service"
},
{
"arn": "arn:aws:proton:region-id:123456789012:service/MySimpleService/service-instance/my-instance",
"createdAt": "2021-03-12T22:39:42.318000+00:00",
"deploymentStatus": "SUCCEEDED",
"environmentName": "simple-env",
"lastDeploymentAttemptedAt": "2021-03-12T22:39:43.160000+00:00",
"lastDeploymentSucceededAt": "2021-03-12T22:39:43.160000+00:00",
"name": "my-instance",
"serviceName": "example-svc",
"serviceTemplateArn": "arn:aws:proton:region-id:123456789012:service-template/fargate-service",
"templateMajorVersion": "1",
"templateMinorVersion": "0",
"templateName": "fargate-service"
}
]
}
다음 목록은 인스턴스를 삭제 및 추가하는 데 사용된 편집 예제 spec
를 보여줍니다. 이름이 지정된 기존 인스턴스 my-instance
가 제거되고 이름이 지정된 새 인스턴스 yet-another-instance
가 추가됩니다.
Spec:
proton: ServiceSpec
pipeline:
my_sample_pipeline_optional_input: "abc"
my_sample_pipeline_required_input: "123"
instances:
- name: "my-other-instance"
environment: "simple-env"
spec:
my_sample_service_instance_required_input: "789"
- name: "yet-another-instance"
environment: "simple-env"
spec:
my_sample_service_instance_required_input: "789"
값이 spec
에 있는 경우 "${Proton::CURRENT_VAL}"
을 원본 spec
에서 보존할 파라미터 값을 지정하는 데 사용할 수 있습니다. 서비스 데이터 보기에 설명된 대로 서비스의 원본 spec
을 보는 데 get-service
을 사용합니다.
다음 목록은 "${Proton::CURRENT_VAL}"
을 사용하여 기존 서비스 인스턴스가 유지되도록 spec
이 파라미터 값 변경 사항을 포함하지 않도록 하는 방법을 보여줍니다.
Spec:
proton: ServiceSpec
pipeline:
my_sample_pipeline_optional_input: "${Proton::CURRENT_VAL}"
my_sample_pipeline_required_input: "${Proton::CURRENT_VAL}"
instances:
- name: "my-other-instance"
environment: "simple-env"
spec:
my_sample_service_instance_required_input: "${Proton::CURRENT_VAL}"
- name: "yet-another-instance"
environment: "simple-env"
spec:
my_sample_service_instance_required_input: "789"
다음 목록은 서비스를 편집하기 위한 CLI 명령 및 응답을 보여줍니다.
명령:
$
aws proton update-service
--name "MySimpleService
" \
--description "Edit by adding and deleting a service instance
" \
--spec "file://spec.yaml
"
응답:
{
"service": {
"arn": "arn:aws:proton:region-id:123456789012:service/MySimpleService",
"branchName": "main",
"createdAt": "2021-03-12T22:39:42.318000+00:00",
"description": "Edit by adding and deleting a service instance",
"lastModifiedAt": "2021-03-12T22:55:48.169000+00:00",
"name": "MySimpleService",
"repositoryConnectionArn": "arn:aws:codestar-connections:region-id:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
"repositoryId": "my-repository/myorg-myapp",
"status": "UPDATE_IN_PROGRESS",
"templateName": "fargate-service"
}
}
다음 list-service-instances
명령 및 응답은 명명된 기존 인스턴스 my-instance
가 제거되고 이름이 지정된 새 인스턴스 yet-another-instance
가 추가되었음을 확인합니다.
명령:
$
aws proton list-service-instances \
--service-name "MySimpleService
"
응답:
{
"serviceInstances": [
{
"arn": "arn:aws:proton:region-id:123456789012:service/MySimpleService/service-instance/yet-another-instance",
"createdAt": "2021-03-12T22:39:42.318000+00:00",
"deploymentStatus": "SUCCEEDED",
"environmentName": "simple-env",
"lastDeploymentAttemptedAt": "2021-03-12T22:56:01.565000+00:00",
"lastDeploymentSucceededAt": "2021-03-12T22:56:01.565000+00:00",
"name": "yet-another-instance",
"serviceName": "MySimpleService",
"templateMajorVersion": "1",
"templateMinorVersion": "0",
"templateName": "fargate-service"
},
{
"arn": "arn:aws:proton:region-id:123456789012:service/MySimpleService/service-instance/my-other-instance",
"createdAt": "2021-03-12T22:39:42.318000+00:00",
"deploymentStatus": "SUCCEEDED",
"environmentName": "simple-env",
"lastDeploymentAttemptedAt": "2021-03-12T22:39:43.109000+00:00",
"lastDeploymentSucceededAt": "2021-03-12T22:39:43.109000+00:00",
"name": "my-other-instance",
"serviceName": "MySimpleService",
"templateMajorVersion": "1",
"templateMinorVersion": "0",
"templateName": "fargate-service"
}
]
}