本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
Amazon ECS服務部署狀態變更事件
Amazon 會使用詳細資訊類型部署狀態變更來ECS傳送服務ECS部署變更狀態事件。以下是用於建立 Amazon ECS服務部署狀態變更事件 EventBridge 規則的事件模式。如需建立 EventBridge 規則的詳細資訊,請參閱《Amazon EventBridge 使用者指南》中的 Amazon EventBridge 入門。
{ "source": [ "aws.ecs" ], "detail-type": [ "ECS Deployment State Change" ] }
Amazon 會使用 INFO
和 事件類型ECS來傳送ERROR
事件。以下是服務部署狀態變更事件。
SERVICE_DEPLOYMENT_IN_PROGRESS
-
服務部署正在進行。此事件會被傳送用於初始部署和回復部署。
SERVICE_DEPLOYMENT_COMPLETED
-
服務部署完成。一旦服務在部署後達到穩定狀態,此事件將被傳送。
SERVICE_DEPLOYMENT_FAILED
-
服務部署失敗。此事件會被傳送用於開啟部署斷路器邏輯的服務。
範例 服務部署正在進行事件
服務部署正在進行事件會在初始和回復部署均已開始時交付。兩者之間的區別位於 reason
欄位。如需 EventBridge 參數的詳細資訊,請參閱《Amazon EventBridge 使用者指南》中的AWS 服務事件中繼資料。
下列顯示初始部署開始的輸出範例。
{
"version": "0",
"id": "ddca6449-b258-46c0-8653-e0e3a6EXAMPLE",
"detail-type": "ECS Deployment State Change",
"source": "aws.ecs",
"account": "111122223333",
"time": "2020-05-23T12:31:14Z",
"region": "us-west-2",
"resources": [
"arn:aws:ecs:us-west-2:111122223333:service/default/servicetest"
],
"detail": {
"eventType": "INFO",
"eventName": "SERVICE_DEPLOYMENT_IN_PROGRESS",
"deploymentId": "ecs-svc/123
",
"updatedAt": "2020-05-23T11:11:11Z",
"reason": "ECS deployment deploymentId
in progress."
}
}
下列顯示回復部署開始的輸出範例。reason
欄位提供服務轉返至的部署 ID。
{
"version": "0",
"id": "ddca6449-b258-46c0-8653-e0e3aEXAMPLE",
"detail-type": "ECS Deployment State Change",
"source": "aws.ecs",
"account": "111122223333",
"time": "2020-05-23T12:31:14Z",
"region": "us-west-2",
"resources": [
"arn:aws:ecs:us-west-2:111122223333:service/default/servicetest"
],
"detail": {
"eventType": "INFO",
"eventName": "SERVICE_DEPLOYMENT_IN_PROGRESS",
"deploymentId": "ecs-svc/123",
"updatedAt": "2020-05-23T11:11:11Z",
"reason": "ECS deployment circuit breaker: rolling back to deploymentId deploymentID
."
}
}
範例 服務部署完成事件
任務部署完成狀態事件以下列格式交付。如需詳細資訊,請參閱透過取代任務來部署 Amazon ECS服務。
{
"version": "0",
"id": "ddca6449-b258-46c0-8653-e0e3aEXAMPLE",
"detail-type": "ECS Deployment State Change",
"source": "aws.ecs",
"account": "111122223333",
"time": "2020-05-23T12:31:14Z",
"region": "us-west-2",
"resources": [
"arn:aws:ecs:us-west-2:111122223333:service/default/servicetest"
],
"detail": {
"eventType": "INFO",
"eventName": "SERVICE_DEPLOYMENT_COMPLETED",
"deploymentId": "ecs-svc/123",
"updatedAt": "2020-05-23T11:11:11Z",
"reason": "ECS deployment deploymentID
completed."
}
}
範例 服務部署失敗事件
任務部署失敗狀態事件以下列格式交付。服務部署失敗狀態事件只會被傳送用於開啟部署斷路器邏輯的服務。如需詳細資訊,請參閱透過取代任務來部署 Amazon ECS服務。
{
"version": "0",
"id": "ddca6449-b258-46c0-8653-e0e3aEXAMPLE",
"detail-type": "ECS Deployment State Change",
"source": "aws.ecs",
"account": "111122223333",
"time": "2020-05-23T12:31:14Z",
"region": "us-west-2",
"resources": [
"arn:aws:ecs:us-west-2:111122223333:service/default/servicetest"
],
"detail": {
"eventType": "ERROR",
"eventName": "SERVICE_DEPLOYMENT_FAILED",
"deploymentId": "ecs-svc/123",
"updatedAt": "2020-05-23T11:11:11Z",
"reason": "ECS deployment circuit breaker: task failed to start."
}
}