本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
更新服務管線
了解如何更新AWS Proton服務管道並取消更新。
服務管線屬於服務。您只能在服務內容進行建立或刪除管道創建和刪除動作。
更新服務管線有四種模式,如下列清單所述。當您使用AWS CLI,該deployment-type
字段定義模式。使用主控台時,這些模式會對應到編輯管道和更新至建議版本。
-
NONE
在此模式下,部署不發生。只會更新要求的中繼資料參數。
-
CURRENT_VERSION
在此模式中,服務管線會部署並使用您提供的新規格進行更新。只會更新要求的參數。Don't (不)當您使用此參數時,包括次要或主要版本參數
deployment-type
。 -
MINOR_VERSION
在此模式下,依預設,服務管線會以目前使用的主要版本的已發佈建議 (最新) 次要版本進行部署和更新。您也可以指定目前正在使用的主要版本的不同次要版本。
-
MAJOR_VERSION
在此模式下,依預設,服務管線會以目前範本的已發佈、建議 (最新) 主要和次要版本進行部署和更新。您也可以指定高於使用中的主要版本和次要版本 (選用) 的不同主要版本。
您可以嘗試取消服務管道更新部署deploymentStatus
是IN_PROGRESS
。AWS Proton嘗試取消部署。不能保證取消成功。
當您取消更新部署時,AWS Proton嘗試取消部署,如下列步驟所列。
-
將部署狀態設定為
CANCELLING
。 -
停止處理中的部署,並刪除部署在下列情況下建立的任何新資源
IN_PROGRESS
。 -
將部署狀態設定為
CANCELLED
。 -
將資源的狀態還原為開始部署之前的狀態。
如需取消服務管線部署的詳細資訊,請參閱CancelServicePipelineDeployment中的AWS ProtonAPI 參考。
使用主控台或AWS CLI以進行更新或取消更新部署。
- AWS Management Console
-
使用主控台更新服務管線,如下列步驟所述。
-
在 中AWS Proton安慰
,選擇服務。 -
在服務清單中,選擇您要為其更新管道的服務名稱。
-
服務詳細資訊頁面上有兩個標籤,概要和管道。選擇管道。
-
如果您想要更新規格,請選擇編輯管道並填寫每個表格並選擇下一頁直到您完成最終表格,然後選擇更新管道。
如果你想更新到一個新版本,並有一個資訊圖示表示新版本可用於管道範本下,選擇新的版本版本的名稱。
-
選擇更新至建議版本。
-
填寫每個表格並選擇下一頁直到您完成最終表格並選擇更新。
-
-
- AWS CLI
-
將服務管線更新為新的次要版本,如下列 CLI 範例命令和回應所示。
當您使用已修改的服務管道更新時
spec
,您可以使用"${Proton::CURRENT_VAL}"
以指示要保留原始參數值spec
,如果值存在於spec
。使用get-service
以檢視原始spec
對於服務管線,如中所述檢視服務資料。下列範例會顯示作法:
"${Proton::CURRENT_VAL}"
在一個spec
。規格格:
proton: ServiceSpec pipeline: my_sample_pipeline_optional_input: "${Proton::CURRENT_VAL}" my_sample_pipeline_required_input: "${Proton::CURRENT_VAL}" instances: - name: "my-instance" environment: "simple-env" spec: my_sample_service_instance_optional_input: "${Proton::CURRENT_VAL}" my_sample_service_instance_required_input: "${Proton::CURRENT_VAL}" - name: "my-other-instance" environment: "simple-env" spec: my_sample_service_instance_required_input: "789"
命令:更新
$
aws proton update-service-pipeline \ --service-name "
simple-svc
" \ --spec "file://service-spec.yaml
" \ --template-major-version "1
" \ --template-minor-version "1
" \ --deployment-type "MINOR_VERSION
"回應:
{ "pipeline": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/pipeline/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "IN_PROGRESS", "lastDeploymentAttemptedAt": "2021-04-02T21:39:28.991000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:29:59.962000+00:00", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"my-instance\"\n environment: \"MySimpleEnv\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"MySimpleEnv\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "templateMajorVersion": "1", "templateMinorVersion": "0", "templateName": "svc-simple" } }
命令:取得並確認狀態
$
aws proton get-service \ --name "
simple-svc
"回應:
{ "service": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc", "branchName": "main", "createdAt": "2021-04-02T21:29:59.962000+00:00", "lastModifiedAt": "2021-04-02T21:30:54.364000+00:00", "name": "simple-svc", "pipeline": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/pipeline", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "SUCCEEDED", "lastDeploymentAttemptedAt": "2021-04-02T21:39:28.991000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:39:28.991000+00:00", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"instance-one\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "templateMajorVersion": "1", "templateMinorVersion": "1", "templateName": "svc-simple" }, "repositoryConnectionArn": "arn:aws:codestar-connections:region-id:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "repositoryId": "repo-name/myorg-myapp", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"instance-one\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "status": "ACTIVE", "templateName": "svc-simple" } }
- AWS Management Console
-
使用主控台取消服務管線部署,如下列步驟所示。
-
在 中AWS Proton安慰
,選擇服務位於導覽窗格中。 -
在服務清單中,選擇具有您欲取消部署更新的管道的服務名稱。
-
在服務詳細資訊頁面,選擇管道索引標籤。
-
如果您的更新部署狀態為In progress (正在進行),在服務管道詳細資訊頁面中,選擇取消部署。
-
隨即出現強制回應,請您確認取消。選擇取消部署。
-
您的更新部署狀態設定為取消然後Cancelled完成取消。
-
- AWS CLI
-
將 IN_PROGRESS 服務管線部署更新取消至次要版本 2,如下列 CLI 範例命令和回應所示。
等待條件包含在用於此範例的範本中,以便在更新部署成功之前開始取消。
命令:取消
$
aws proton cancel-service-pipeline-deployment \ --service-name "
simple-svc
"回應:
{ "pipeline": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/pipeline", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "CANCELLING", "lastDeploymentAttemptedAt": "2021-04-02T22:02:45.095000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:39:28.991000+00:00", "templateMajorVersion": "1", "templateMinorVersion": "1", "templateName": "svc-simple" } }
命令:取得並確認狀態
$
aws proton get-service \ --name "
simple-svc
"回應:
{ "service": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc", "branchName": "main", "createdAt": "2021-04-02T21:29:59.962000+00:00", "lastModifiedAt": "2021-04-02T21:30:54.364000+00:00", "name": "simple-svc", "pipeline": { "arn": "arn:aws:proton:region-id:123456789012:service/simple-svc/pipeline", "createdAt": "2021-04-02T21:29:59.962000+00:00", "deploymentStatus": "CANCELLED", "deploymentStatusMessage": "User initiated cancellation.", "lastDeploymentAttemptedAt": "2021-04-02T22:02:45.095000+00:00", "lastDeploymentSucceededAt": "2021-04-02T21:39:28.991000+00:00", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"instance-one\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "templateMajorVersion": "1", "templateMinorVersion": "1", "templateName": "svc-simple" }, "repositoryConnectionArn": "arn:aws:codestar-connections:region-id:123456789012:connection/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "repositoryId": "repo-name/myorg-myapp", "spec": "proton: ServiceSpec\n\npipeline:\n my_sample_pipeline_optional_input: \"abc\"\n my_sample_pipeline_required_input: \"123\"\n\ninstances:\n - name: \"instance-one\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_optional_input: \"def\"\n my_sample_service_instance_required_input: \"456\"\n - name: \"my-other-instance\"\n environment: \"simple-env\"\n spec:\n my_sample_service_instance_required_input: \"789\"\n", "status": "ACTIVE", "templateName": "svc-simple" } }