GetDeploymentInstance 搭配 CLI 使用 - AWS SDK 程式碼範例

文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的 GitHub 範例。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

GetDeploymentInstance 搭配 CLI 使用

下列程式碼範例示範如何使用 GetDeploymentInstance

CLI
AWS CLI

若要取得部署執行個體的相關資訊

下列get-deployment-instance範例顯示與指定部署相關聯的部署執行個體資訊。

aws deploy get-deployment-instance --deployment-id d-QA4G4F9EX --instance-id i-902e9fEX

輸出:

{ "instanceSummary": { "instanceId": "arn:aws:ec2:us-east-1:80398EXAMPLE:instance/i-902e9fEX", "lifecycleEvents": [ { "status": "Succeeded", "endTime": 1408480726.569, "startTime": 1408480726.437, "lifecycleEventName": "ApplicationStop" }, { "status": "Succeeded", "endTime": 1408480728.016, "startTime": 1408480727.665, "lifecycleEventName": "DownloadBundle" }, { "status": "Succeeded", "endTime": 1408480729.744, "startTime": 1408480729.125, "lifecycleEventName": "BeforeInstall" }, { "status": "Succeeded", "endTime": 1408480730.979, "startTime": 1408480730.844, "lifecycleEventName": "Install" }, { "status": "Failed", "endTime": 1408480732.603, "startTime": 1408480732.1, "lifecycleEventName": "AfterInstall" }, { "status": "Skipped", "endTime": 1408480732.606, "lifecycleEventName": "ApplicationStart" }, { "status": "Skipped", "endTime": 1408480732.606, "lifecycleEventName": "ValidateService" } ], "deploymentId": "d-QA4G4F9EX", "lastUpdatedAt": 1408480733.152, "status": "Failed" } }
PowerShell
for PowerShell 工具

範例 1:此範例會取得指定部署之指定執行個體的相關資訊。

Get-CDDeploymentInstance -DeploymentId d-QZMRGSTEX -InstanceId i-254e22EX

輸出:

DeploymentId : d-QZMRGSTEX InstanceId : arn:aws:ec2:us-east-1:80398EXAMPLE:instance/i-254e22EX LastUpdatedAt : 7/23/2015 11:25:24 PM LifecycleEvents : {ApplicationStop, DownloadBundle, BeforeInstall, Install...} Status : Succeeded
  • 如需 API 詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考中的 GetDeploymentInstance