GetDeployment与 a 一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

GetDeployment与 a 一起使用 CLI

以下代码示例演示如何使用 GetDeployment

CLI
AWS CLI

获取有关部署的信息

以下get-deployment示例显示与用户 AWS 账户关联的部署的相关信息。

aws deploy get-deployment --deployment-id d-A1B2C3123

输出:

{ "deploymentInfo": { "applicationName": "WordPress_App", "status": "Succeeded", "deploymentOverview": { "Failed": 0, "InProgress": 0, "Skipped": 0, "Succeeded": 1, "Pending": 0 }, "deploymentConfigName": "CodeDeployDefault.OneAtATime", "creator": "user", "description": "My WordPress app deployment", "revision": { "revisionType": "S3", "s3Location": { "bundleType": "zip", "eTag": "\"dd56cfdEXAMPLE8e768f9d77fEXAMPLE\"", "bucket": "CodeDeployDemoBucket", "key": "WordPressApp.zip" } }, "deploymentId": "d-A1B2C3123", "deploymentGroupName": "WordPress_DG", "createTime": 1409764576.589, "completeTime": 1409764596.101, "ignoreApplicationStopFailures": false } }
PowerShell
用于 PowerShell

示例 1:此示例获取有关指定部署的摘要信息。

Get-CDDeployment -DeploymentId d-QZMRGSTEX

输出:

ApplicationName : CodeDeployDemoApplication CompleteTime : 7/23/2015 11:26:04 PM CreateTime : 7/23/2015 11:24:43 PM Creator : user DeploymentConfigName : CodeDeployDefault.OneAtATime DeploymentGroupName : CodeDeployDemoFleet DeploymentId : d-QZMRGSTEX DeploymentOverview : Amazon.CodeDeploy.Model.DeploymentOverview Description : ErrorInformation : IgnoreApplicationStopFailures : False Revision : Amazon.CodeDeploy.Model.RevisionLocation StartTime : 1/1/0001 12:00:00 AM Status : Succeeded

示例 2:此示例获取有关参与指定部署的实例状态的信息。

(Get-CDDeployment -DeploymentId d-QZMRGSTEX).DeploymentOverview

输出:

Failed : 0 InProgress : 0 Pending : 0 Skipped : 0 Succeeded : 3

示例 3:此示例获取有关指定部署的应用程序修订的信息。

(Get-CDDeployment -DeploymentId d-QZMRGSTEX).Revision.S3Location

输出:

Bucket : MyBucket BundleType : zip ETag : cfbb81b304ee5e27efc21adaed3EXAMPLE Key : clzfqEX Version :
  • 有关API详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考GetDeployment中的。