Utilizzare BatchGetOnPremisesInstances con una CLI - Esempi di codice per SDK AWS

Sono disponibili altri esempi per SDK AWS nel repository GitHub della documentazione degli esempi per SDK AWS.

Utilizzare BatchGetOnPremisesInstances con una CLI

Gli esempi di codice seguenti mostrano come utilizzare BatchGetOnPremisesInstances.

CLI
AWS CLI

Come ottenere informazioni su una o più istanze on-premises

L’esempio batch-get-on-premises-instances seguente ottiene informazioni su due istanze on-premises.

aws deploy batch-get-on-premises-instances --instance-names AssetTag12010298EX AssetTag23121309EX

Output:

{ "instanceInfos": [ { "iamUserArn": "arn:aws:iam::123456789012:user/AWS/CodeDeploy/AssetTag12010298EX", "tags": [ { "Value": "CodeDeployDemo-OnPrem", "Key": "Name" } ], "instanceName": "AssetTag12010298EX", "registerTime": 1425579465.228, "instanceArn": "arn:aws:codedeploy:us-west-2:123456789012:instance/AssetTag12010298EX_4IwLNI2Alh" }, { "iamUserArn": "arn:aws:iam::123456789012:user/AWS/CodeDeploy/AssetTag23121309EX", "tags": [ { "Value": "CodeDeployDemo-OnPrem", "Key": "Name" } ], "instanceName": "AssetTag23121309EX", "registerTime": 1425595585.988, "instanceArn": "arn:aws:codedeploy:us-west-2:80398EXAMPLE:instance/AssetTag23121309EX_PomUy64Was" } ] }
PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio ottiene informazioni sulle istanze on-premises specificate.

Get-CDOnPremiseInstanceBatch -InstanceName AssetTag12010298EX, AssetTag12010298EX-2

Output:

DeregisterTime : 1/1/0001 12:00:00 AM IamUserArn : arn:aws:iam::80398EXAMPLE:user/CodeDeployFRWUser InstanceArn : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX-2_XmeSz18rEX InstanceName : AssetTag12010298EX-2 RegisterTime : 4/3/2015 6:38:52 PM Tags : {Name} DeregisterTime : 1/1/0001 12:00:00 AM IamUserArn : arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser InstanceArn : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX_rDH556dxEX InstanceName : AssetTag12010298EX RegisterTime : 4/3/2015 6:36:24 PM Tags : {Name}
  • Per informazioni dettagliate sull’API, consulta BatchGetOnPremisesInstances nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V4).

Strumenti per PowerShell V5

Esempio 1: questo esempio ottiene informazioni sulle istanze on-premises specificate.

Get-CDOnPremiseInstanceBatch -InstanceName AssetTag12010298EX, AssetTag12010298EX-2

Output:

DeregisterTime : 1/1/0001 12:00:00 AM IamUserArn : arn:aws:iam::80398EXAMPLE:user/CodeDeployFRWUser InstanceArn : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX-2_XmeSz18rEX InstanceName : AssetTag12010298EX-2 RegisterTime : 4/3/2015 6:38:52 PM Tags : {Name} DeregisterTime : 1/1/0001 12:00:00 AM IamUserArn : arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser InstanceArn : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX_rDH556dxEX InstanceName : AssetTag12010298EX RegisterTime : 4/3/2015 6:36:24 PM Tags : {Name}
  • Per informazioni dettagliate sull’API, consulta BatchGetOnPremisesInstances nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V5).