Usar DescribeNetworkInterfaceAttribute com uma CLI - Exemplos de código do AWS SDK

Há mais exemplos do AWS SDK disponíveis no repositório do GitHub Documento de Exemplos do AWS SDK.

Usar DescribeNetworkInterfaceAttribute com uma CLI

Os exemplos de código a seguir mostram como usar o DescribeNetworkInterfaceAttribute.

CLI
AWS CLI

Descrever o atributo de anexo de uma interface de rede

Este exemplo de comando descreve o atributo attachment da interface de rede especificada.

Comando:

aws ec2 describe-network-interface-attribute --network-interface-id eni-686ea200 --attribute attachment

Saída:

{ "NetworkInterfaceId": "eni-686ea200", "Attachment": { "Status": "attached", "DeviceIndex": 0, "AttachTime": "2015-05-21T20:02:20.000Z", "InstanceId": "i-1234567890abcdef0", "DeleteOnTermination": true, "AttachmentId": "eni-attach-43348162", "InstanceOwnerId": "123456789012" } }

Descrever o atributo de descrição de uma interface de rede

Este exemplo de comando descreve o atributo description da interface de rede especificada.

Comando:

aws ec2 describe-network-interface-attribute --network-interface-id eni-686ea200 --attribute description

Saída:

{ "NetworkInterfaceId": "eni-686ea200", "Description": { "Value": "My description" } }

Descrever o atributo groupSet de uma interface de rede

Este exemplo de comando descreve o atributo groupSet da interface de rede especificada.

Comando:

aws ec2 describe-network-interface-attribute --network-interface-id eni-686ea200 --attribute groupSet

Saída:

{ "NetworkInterfaceId": "eni-686ea200", "Groups": [ { "GroupName": "my-security-group", "GroupId": "sg-903004f8" } ] }

Descrever o atributo sourceDestCheck de uma interface de rede

Este exemplo de comando descreve o atributo sourceDestCheck da interface de rede especificada.

Comando:

aws ec2 describe-network-interface-attribute --network-interface-id eni-686ea200 --attribute sourceDestCheck

Saída:

{ "NetworkInterfaceId": "eni-686ea200", "SourceDestCheck": { "Value": true } }
PowerShell
Ferramentas para PowerShell V4

Exemplo 1: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute Attachment

Saída:

Attachment : Amazon.EC2.Model.NetworkInterfaceAttachment

Exemplo 2: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute Description

Saída:

Description : My description

Exemplo 3: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute GroupSet

Saída:

Groups : {my-security-group}

Exemplo 4: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute SourceDestCheck

Saída:

SourceDestCheck : True
Ferramentas para PowerShell V5

Exemplo 1: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute Attachment

Saída:

Attachment : Amazon.EC2.Model.NetworkInterfaceAttachment

Exemplo 2: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute Description

Saída:

Description : My description

Exemplo 3: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute GroupSet

Saída:

Groups : {my-security-group}

Exemplo 4: esse exemplo descreve a interface de rede especificada.

Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute SourceDestCheck

Saída:

SourceDestCheck : True