There are more AWS SDK examples available in the AWS Doc SDK Examples
Network Manager examples using AWS CLI
The following code examples show you how to perform actions and implement common scenarios by using the AWS Command Line Interface with Network Manager.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use associate-customer-gateway
.
- AWS CLI
-
To associate a customer gateway
The following
associate-customer-gateway
example associates customer gatewaycgw-11223344556677889
in the specified global network with devicedevice-07f6fd08867abc123
.aws networkmanager associate-customer-gateway \ --customer-gateway-arn
arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889
\ --global-network-idglobal-network-01231231231231231
\ --device-iddevice-07f6fd08867abc123
\ --regionus-west-2
Output:
{ "CustomerGatewayAssociation": { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "PENDING" } }
For more information, see Customer Gateway Associations in the Transit Gateway Network Manager Guide.
-
For API details, see AssociateCustomerGateway
in AWS CLI Command Reference.
-
The following code example shows how to use associate-link
.
- AWS CLI
-
To associate a link
The following
associate-link
example associates linklink-11112222aaaabbbb1
with devicedevice-07f6fd08867abc123
. The link and device are in the specified global network.aws networkmanager associate-link \ --global-network-id
global-network-01231231231231231
\ --device-iddevice-07f6fd08867abc123
\ --link-idlink-11112222aaaabbbb1
\ --regionus-west-2
Output:
{ "LinkAssociation": { "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "LinkId": "link-11112222aaaabbbb1", "LinkAssociationState": "PENDING" } }
For more information, see Device and Link Associations in the Transit Gateway Network Manager Guide.
-
For API details, see AssociateLink
in AWS CLI Command Reference.
-
The following code example shows how to use create-core-network
.
- AWS CLI
-
To create a core network
The following
create-core-network
example creates a core network using an optional description and tags within an AWS Cloud WAN global network.aws networkmanager create-core-network \ --global-network-id
global-network-cdef-EXAMPLE22222
\ --description"Main headquarters location"
\ --tags Key=Name,Value="New York City office"Output:
{ "CoreNetwork": { "GlobalNetworkId": "global-network-cdef-EXAMPLE22222", "CoreNetworkId": "core-network-cdef-EXAMPLE33333", "CoreNetworkArn": "arn:aws:networkmanager::987654321012:core-network/core-network-cdef-EXAMPLE33333", "Description": "Main headquarters location", "CreatedAt": "2022-01-10T19:53:59+00:00", "State": "AVAILABLE", "Tags": [ { "Key": "Name", "Value": "New York City office" } ] } }
For more information, see Global and core networks in the AWS Cloud WAN User Guide.
-
For API details, see CreateCoreNetwork
in AWS CLI Command Reference.
-
The following code example shows how to use create-device
.
- AWS CLI
-
To create a device
The following
create-device
example creates a device in the specified global network. The device details include a description, the type, vendor, model, and serial number.aws networkmanager create-device --global-network-id
global-network-01231231231231231
\ --description"New York office device"
\ --type"office device"
\ --vendor"anycompany"
\ --model"abcabc"
\ --serial-number"1234"
\ --regionus-west-2
Output:
{ "Device": { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York office device", "Type": "office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "CreatedAt": 1575554005.0, "State": "PENDING" } }
For more information, see Working with Devices in the Transit Gateway Network Manager Guide.
-
For API details, see CreateDevice
in AWS CLI Command Reference.
-
The following code example shows how to use create-global-network
.
- AWS CLI
-
To create a global network
The following
create-global-network
examples creates a new global network. The initial state upon creation isPENDING
.aws networkmanager create-global-network
Output:
{ "GlobalNetwork": { "GlobalNetworkId": "global-network-00a77fc0f722dae74", "GlobalNetworkArn": "arn:aws:networkmanager::987654321012:global-network/global-network-00a77fc0f722dae74", "CreatedAt": "2022-03-14T20:31:56+00:00", "State": "PENDING" } }
-
For API details, see CreateGlobalNetwork
in AWS CLI Command Reference.
-
The following code example shows how to use create-link
.
- AWS CLI
-
To create a link
The following
create-link
example creates a link in the specified global network. The link includes a description and details about the link type, bandwidth, and provider. The site ID indicates the site to which the link is associated.aws networkmanager create-link \ --global-network-id
global-network-01231231231231231
\ --description"VPN Link"
\ --type"broadband"
\ --bandwidthUploadSpeed=10,DownloadSpeed=20
\ --provider"AnyCompany"
\ --site-idsite-444555aaabbb11223
\ --regionus-west-2
Output:
{ "Link": { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 10, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "PENDING" } }
For more information, see Working with Links in the Transit Gateway Network Manager Guide.
-
For API details, see CreateLink
in AWS CLI Command Reference.
-
The following code example shows how to use create-site
.
- AWS CLI
-
To create a site
The following
create-site
example creates a site in the specified global network. The site details include a description and the location information.aws networkmanager create-site \ --global-network-id
global-network-01231231231231231
\ --description"New York head office"
\ --locationLatitude=40.7128,Longitude=-74.0060
\ --regionus-west-2
Output:
{ "Site": { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York head office", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554300.0, "State": "PENDING" } }
For more information, see Working with Sites in the Transit Gateway Network Manager Guide.
-
For API details, see CreateSite
in AWS CLI Command Reference.
-
The following code example shows how to use create-vpc-attachment
.
- AWS CLI
-
To create a VPC attachment
The following
create-vpc-attachment
example creates a VPC attachment with IPv6 support in a core network.aws networkmanager create-vpc-attachment \ --core-network-id
core-network-0fab62fe438d94db6
\ --vpc-arnarn:aws:ec2:us-east-1:987654321012:vpc/vpc-09f37f69e2786eeb8
\ --subnet-arnsarn:aws:ec2:us-east-1:987654321012:subnet/subnet-04ca4e010857e7bb7
\ --Ipv6Support=trueOutput:
{ "VpcAttachment": { "Attachment": { "CoreNetworkId": "core-network-0fab62fe438d94db6", "AttachmentId": "attachment-05e1da6eba87a06e6", "OwnerAccountId": "987654321012", "AttachmentType": "VPC", "State": "CREATING", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:ec2:us-east-1:987654321012:vpc/vpc-09f37f69e2786eeb8", "Tags": [], "CreatedAt": "2022-03-10T20:59:14+00:00", "UpdatedAt": "2022-03-10T20:59:14+00:00" }, "SubnetArns": [ "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-04ca4e010857e7bb7" ], "Options": { "Ipv6Support": true } } }
For more information, see Create an attachment in the Cloud WAN User Guide.
-
For API details, see CreateVpcAttachment
in AWS CLI Command Reference.
-
The following code example shows how to use delete-attachment
.
- AWS CLI
-
To delete an attachment
The following
delete-attachment
example deletes a Connect attachment.aws networkmanager delete-attachment \ --attachment-id
attachment-01feddaeae26ab68c
Output:
{ "Attachment": { "CoreNetworkId": "core-network-0f4b0a9d5ee7761d1", "AttachmentId": "attachment-01feddaeae26ab68c", "OwnerAccountId": "987654321012", "AttachmentType": "CONNECT", "State": "DELETING", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:networkmanager::987654321012:attachment/attachment-02c3964448fedf5aa", "CreatedAt": "2022-03-15T19:18:41+00:00", "UpdatedAt": "2022-03-15T19:28:59+00:00" } }
For more information, see Delete attachments in the Cloud WAN User Guide.
-
For API details, see DeleteAttachment
in AWS CLI Command Reference.
-
The following code example shows how to use delete-bucket-analytics-configuration
.
- AWS CLI
-
To delete an analytics configuration for a bucket
The following
delete-bucket-analytics-configuration
example removes the analytics configuration for the specified bucket and ID.aws s3api delete-bucket-analytics-configuration \ --bucket
my-bucket
\ --id1
This command produces no output.
-
For API details, see DeleteBucketAnalyticsConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use delete-bucket-metrics-configuration
.
- AWS CLI
-
To delete a metrics configuration for a bucket
The following
delete-bucket-metrics-configuration
example removes the metrics configuration for the specified bucket and ID.aws s3api delete-bucket-metrics-configuration \ --bucket
my-bucket
\ --id123
This command produces no output.
-
For API details, see DeleteBucketMetricsConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use delete-core-network
.
- AWS CLI
-
To delete a core network
The following
delete-core-network
example deletes a core network from a Cloud WAN global network.aws networkmanager delete-core-network \ --core-network-id
core-network-0fab62fe438d94db6
Output:
{ "CoreNetwork": { "GlobalNetworkId": "global-network-0d59060f16a73bc41", "CoreNetworkId": "core-network-0fab62fe438d94db6", "Description": "Main headquarters location", "CreatedAt": "2021-12-09T18:31:11+00:00", "State": "DELETING", "Segments": [ { "Name": "dev", "EdgeLocations": [ "us-east-1" ], "SharedSegments": [] } ], "Edges": [ { "EdgeLocation": "us-east-1", "Asn": 64512, "InsideCidrBlocks": [] } ] } }
For more information, see Core networks in the Cloud WAN User Guide.
-
For API details, see DeleteCoreNetwork
in AWS CLI Command Reference.
-
The following code example shows how to use delete-device
.
- AWS CLI
-
To delete a device
The following
delete-device
example deletes the specified device from the specified global network.aws networkmanager delete-device \ --global-network-id
global-network-01231231231231231
\ --device-iddevice-07f6fd08867abc123
\ --regionus-west-2
Output:
{ "Device": { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York office device", "Type": "office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "SiteId": "site-444555aaabbb11223", "CreatedAt": 1575554005.0, "State": "DELETING" } }
For more information, see Working with Devices in the Transit Gateway Network Manager Guide.
-
For API details, see DeleteDevice
in AWS CLI Command Reference.
-
The following code example shows how to use delete-global-network
.
- AWS CLI
-
To delete a global network
The following
delete-global-network
example deletes a global network.aws networkmanager delete-global-network \ --global-network-id
global-network-052bedddccb193b6b
Output:
{ "GlobalNetwork": { "GlobalNetworkId": "global-network-052bedddccb193b6b", "GlobalNetworkArn": "arn:aws:networkmanager::987654321012:global-network/global-network-052bedddccb193b6b", "CreatedAt": "2021-12-09T18:19:12+00:00", "State": "DELETING" } }
-
For API details, see DeleteGlobalNetwork
in AWS CLI Command Reference.
-
The following code example shows how to use delete-link
.
- AWS CLI
-
To delete a link
The following
delete-link
example deletes the specified link from the specified global network.aws networkmanager delete-link \ --global-network-id
global-network-01231231231231231
\ --link-idlink-11112222aaaabbbb1
\ --regionus-west-2
Output:
{ "Link": { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 20, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "DELETING" } }
For more information, see Working with Links in the Transit Gateway Network Manager Guide.
-
For API details, see DeleteLink
in AWS CLI Command Reference.
-
The following code example shows how to use delete-public-access-block
.
- AWS CLI
-
To delete the block public access configuration for a bucket
The following
delete-public-access-block
example removes the block public access configuration on the specified bucket.aws s3api delete-public-access-block \ --bucket
my-bucket
This command produces no output.
-
For API details, see DeletePublicAccessBlock
in AWS CLI Command Reference.
-
The following code example shows how to use delete-site
.
- AWS CLI
-
To delete a site
The following
delete-site
example deletes the specified site (site-444555aaabbb11223
) in the specified global network.aws networkmanager delete-site \ --global-network-id
global-network-01231231231231231
\ --site-idsite-444555aaabbb11223
\ --regionus-west-2
Output:
{ "Site": { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York head office", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554300.0, "State": "DELETING" } }
For more information, see Working with Sites in the Transit Gateway Network Manager Guide.
-
For API details, see DeleteSite
in AWS CLI Command Reference.
-
The following code example shows how to use deregister-transit-gateway
.
- AWS CLI
-
To deregister a transit gateway from a global network
The following
deregister-transit-gateway
example deregisters the specified transit gateway from the specified global network.aws networkmanager deregister-transit-gateway \ --global-network-id
global-network-01231231231231231
\ --transit-gateway-arnarn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc
\ --regionus-west-2
Output:
{ "TransitGatewayRegistration": { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "DELETING" } } }
For more information, see Transit Gateway Registrations in the Transit Gateway Network Manager Guide.
-
For API details, see DeregisterTransitGateway
in AWS CLI Command Reference.
-
The following code example shows how to use describe-global-networks
.
- AWS CLI
-
To describe your global networks
The following
describe-global-networks
example describes all of your global networks in your account.aws networkmanager describe-global-networks \ --region
us-west-2
Output:
{ "GlobalNetworks": [ { "GlobalNetworkId": "global-network-01231231231231231", "GlobalNetworkArn": "arn:aws:networkmanager::123456789012:global-network/global-network-01231231231231231", "Description": "Company 1 global network", "CreatedAt": 1575553525.0, "State": "AVAILABLE" } ] }
-
For API details, see DescribeGlobalNetworks
in AWS CLI Command Reference.
-
The following code example shows how to use disassociate-customer-gateway
.
- AWS CLI
-
To disassociate a customer gateway
The following
disassociate-customer-gateway
example disassociates the specified customer gateway (cgw-11223344556677889
) from the specified global network.aws networkmanager disassociate-customer-gateway \ --global-network-id
global-network-01231231231231231
\ --customer-gateway-arnarn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889
\ --regionus-west-2
Output:
{ "CustomerGatewayAssociation": { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "DELETING" } }
For more information, see Customer Gateway Associations in the Transit Gateway Network Manager Guide.
-
For API details, see DisassociateCustomerGateway
in AWS CLI Command Reference.
-
The following code example shows how to use disassociate-link
.
- AWS CLI
-
To disassociate a link
The following
disassociate-link
example disassociates the specified link from devicedevice-07f6fd08867abc123
in the specified global network.aws networkmanager disassociate-link \ --global-network-id
global-network-01231231231231231
\ --device-iddevice-07f6fd08867abc123
\ --link-idlink-11112222aaaabbbb1
\ --regionus-west-2
Output:
{ "LinkAssociation": { "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "LinkId": "link-11112222aaaabbbb1", "LinkAssociationState": "DELETING" } }
For more information, see Device and Link Associations in the Transit Gateway Network Manager Guide.
-
For API details, see DisassociateLink
in AWS CLI Command Reference.
-
The following code example shows how to use get-bucket-analytics-configuration
.
- AWS CLI
-
To retrieve the analytics configuration for a bucket with a specific ID
The following
get-bucket-analytics-configuration
example displays the analytics configuration for the specified bucket and ID.aws s3api get-bucket-analytics-configuration \ --bucket
my-bucket
\ --id1
Output:
{ "AnalyticsConfiguration": { "StorageClassAnalysis": {}, "Id": "1" } }
-
For API details, see GetBucketAnalyticsConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use get-bucket-metrics-configuration
.
- AWS CLI
-
To retrieve the metrics configuration for a bucket with a specific ID
The following
get-bucket-metrics-configuration
example displays the metrics configuration for the specified bucket and ID.aws s3api get-bucket-metrics-configuration \ --bucket
my-bucket
\ --id123
Output:
{ "MetricsConfiguration": { "Filter": { "Prefix": "logs" }, "Id": "123" } }
-
For API details, see GetBucketMetricsConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use get-customer-gateway-associations
.
- AWS CLI
-
To get your customer gateway associations
The following
get-customer-gateway-associations
example gets the customer gateway associations for the specified global network.aws networkmanager get-customer-gateway-associations \ --global-network-id
global-network-01231231231231231
\ --regionus-west-2
Output:
{ "CustomerGatewayAssociations": [ { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "AVAILABLE" } ] }
-
For API details, see GetCustomerGatewayAssociations
in AWS CLI Command Reference.
-
The following code example shows how to use get-devices
.
- AWS CLI
-
To get your devices
The following
get-devices
example gets the devices in the specified global network.aws networkmanager get-devices \ --global-network-id
global-network-01231231231231231
\ --regionus-west-2
Output:
{ "Devices": [ { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "NY office device", "Type": "office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "CreatedAt": 1575554005.0, "State": "AVAILABLE" } ] }
-
For API details, see GetDevices
in AWS CLI Command Reference.
-
The following code example shows how to use get-link-associations
.
- AWS CLI
-
To get your link associations
The following
get-link-associations
example gets the link associations in the specified global network.aws networkmanager get-link-associations \ --global-network-id
global-network-01231231231231231
\ --regionus-west-2
Output:
{ "LinkAssociations": [ { "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "LinkId": "link-11112222aaaabbbb1", "LinkAssociationState": "AVAILABLE" } ] }
-
For API details, see GetLinkAssociations
in AWS CLI Command Reference.
-
The following code example shows how to use get-links
.
- AWS CLI
-
To get your links
The following
get-links
example gets the links in the specified global network.aws networkmanager get-links \ --global-network-id
global-network-01231231231231231
\ --regionus-west-2
Output:
{ "Links": [ { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 10, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "AVAILABLE" } ] }
-
For API details, see GetLinks
in AWS CLI Command Reference.
-
The following code example shows how to use get-object-retention
.
- AWS CLI
-
To retrieve the object retention configuration for an object
The following
get-object-retention
example retrieves the object retention configuration for the specified object.aws s3api get-object-retention \ --bucket
my-bucket-with-object-lock
\ --keydoc1.rtf
Output:
{ "Retention": { "Mode": "GOVERNANCE", "RetainUntilDate": "2025-01-01T00:00:00.000Z" } }
-
For API details, see GetObjectRetention
in AWS CLI Command Reference.
-
The following code example shows how to use get-public-access-block
.
- AWS CLI
-
To set or modify the block public access configuration for a bucket
The following
get-public-access-block
example displays the block public access configuration for the specified bucket.aws s3api get-public-access-block --bucket
my-bucket
Output:
{ "PublicAccessBlockConfiguration": { "IgnorePublicAcls": true, "BlockPublicPolicy": true, "BlockPublicAcls": true, "RestrictPublicBuckets": true } }
-
For API details, see GetPublicAccessBlock
in AWS CLI Command Reference.
-
The following code example shows how to use get-sites
.
- AWS CLI
-
To get your sites
The following
get-sites
example gets the sites in the specified global network.aws networkmanager get-sites \ --global-network-id
global-network-01231231231231231
\ --regionus-west-2
Output:
{ "Sites": [ { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "NY head office", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554528.0, "State": "AVAILABLE" } ] }
-
For API details, see GetSites
in AWS CLI Command Reference.
-
The following code example shows how to use get-transit-gateway-registrations
.
- AWS CLI
-
To get your transit gateway registrations
The following
get-transit-gateway-registrations
example gets the transit gateways that are registered to the specified global network.aws networkmanager get-transit-gateway-registrations \ --global-network-id
global-network-01231231231231231
\ --regionus-west-2
Output:
{ "TransitGatewayRegistrations": [ { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "AVAILABLE" } } ] }
-
For API details, see GetTransitGatewayRegistrations
in AWS CLI Command Reference.
-
The following code example shows how to use get-vpc-attachment
.
- AWS CLI
-
To get an a VPC attachment
The following
get-vpc-attachment
example returns information about a VPC attachment.aws networkmanager get-vpc-attachment \ --attachment-id
attachment-03b7ea450134787da
Output:
{ "VpcAttachment": { "Attachment": { "CoreNetworkId": "core-network-0522de1b226a5d7b3", "AttachmentId": "attachment-03b7ea450134787da", "OwnerAccountId": "987654321012", "AttachmentType": "VPC", "State": "CREATING", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:ec2:us-east-1:987654321012:vpc/vpc-a7c4bbda", "Tags": [ { "Key": "Name", "Value": "DevVPC" } ], "CreatedAt": "2022-03-11T17:48:58+00:00", "UpdatedAt": "2022-03-11T17:48:58+00:00" }, "SubnetArns": [ "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-202cde6c", "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-e5022dba", "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-2387ae02", "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-cda9dffc" ], "Options": { "Ipv6Support": false } } }
For more information, see Attachments in the Cloud WAN User Guide.
-
For API details, see GetVpcAttachment
in AWS CLI Command Reference.
-
The following code example shows how to use list-bucket-analytics-configurations
.
- AWS CLI
-
To retrieve a list of analytics configurations for a bucket
The following
list-bucket-analytics-configurations
retrieves a list of analytics configurations for the specified bucket.aws s3api list-bucket-analytics-configurations \ --bucket
my-bucket
Output:
{ "AnalyticsConfigurationList": [ { "StorageClassAnalysis": {}, "Id": "1" } ], "IsTruncated": false }
-
For API details, see ListBucketAnalyticsConfigurations
in AWS CLI Command Reference.
-
The following code example shows how to use list-bucket-metrics-configurations
.
- AWS CLI
-
To retrieve a list of metrics configurations for a bucket
The following
list-bucket-metrics-configurations
example retrieves a list of metrics configurations for the specified bucket.aws s3api list-bucket-metrics-configurations \ --bucket
my-bucket
Output:
{ "IsTruncated": false, "MetricsConfigurationList": [ { "Filter": { "Prefix": "logs" }, "Id": "123" }, { "Filter": { "Prefix": "tmp" }, "Id": "234" } ] }
-
For API details, see ListBucketMetricsConfigurations
in AWS CLI Command Reference.
-
The following code example shows how to use list-tags-for-resource
.
- AWS CLI
-
To list the tags for a resource
The following
list-tags-for-resource
example lists the tags for the specified device resource (device-07f6fd08867abc123
).aws networkmanager list-tags-for-resource \ --resource-arn
arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123
\ --regionus-west-2
Output:
{ "TagList": [ { "Key": "Network", "Value": "Northeast" } ] }
-
For API details, see ListTagsForResource
in AWS CLI Command Reference.
-
The following code example shows how to use put-bucket-metrics-configuration
.
- AWS CLI
-
To set a metrics configuration for a bucket
The following
put-bucket-metrics-configuration
example sets a metric configuration with ID 123 for the specified bucket.aws s3api put-bucket-metrics-configuration \ --bucket
my-bucket
\ --id123
\ --metrics-configuration '{"Id": "123", "Filter": {"Prefix": "logs"}}
'This command produces no output.
-
For API details, see PutBucketMetricsConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use put-object-retention
.
- AWS CLI
-
To set an object retention configuration for an object
The following
put-object-retention
example sets an object retention configuration for the specified object until 2025-01-01.aws s3api put-object-retention \ --bucket
my-bucket-with-object-lock
\ --keydoc1.rtf
\ --retention '{ "Mode": "GOVERNANCE", "RetainUntilDate": "2025-01-01T00:00:00" }
'This command produces no output.
-
For API details, see PutObjectRetention
in AWS CLI Command Reference.
-
The following code example shows how to use put-public-access-block
.
- AWS CLI
-
To set the block public access configuration for a bucket
The following
put-public-access-block
example sets a restrictive block public access configuration for the specified bucket.aws s3api put-public-access-block \ --bucket
my-bucket
\ --public-access-block-configuration"BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
This command produces no output.
-
For API details, see PutPublicAccessBlock
in AWS CLI Command Reference.
-
The following code example shows how to use register-transit-gateway
.
- AWS CLI
-
To register a transit gateway in a global network
The following
register-transit-gateway
example registers transit gatewaytgw-123abc05e04123abc
in the specified global network.aws networkmanager register-transit-gateway \ --global-network-id
global-network-01231231231231231
\ --transit-gateway-arnarn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc
\ --regionus-west-2
Output:
{ "TransitGatewayRegistration": { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "PENDING" } } }
For more information, see Transit Gateway Registrations in the Transit Gateway Network Manager Guide.
-
For API details, see RegisterTransitGateway
in AWS CLI Command Reference.
-
The following code example shows how to use reject-attachment
.
- AWS CLI
-
To reject an attachment
The following
reject-attachment
example rejects a VPC attachment request.aws networkmanager reject-attachment \ --attachment-id
attachment-03b7ea450134787da
Output:
{ "Attachment": { "CoreNetworkId": "core-network-0522de1b226a5d7b3", "AttachmentId": "attachment-03b7ea450134787da", "OwnerAccountId": "987654321012", "AttachmentType": "VPC", "State": "AVAILABLE", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:ec2:us-east-1:987654321012:vpc/vpc-a7c4bbda", "CreatedAt": "2022-03-11T17:48:58+00:00", "UpdatedAt": "2022-03-11T17:51:25+00:00" } }
For more information, see Attachment acceptance in the Cloud WAN User Guide.
-
For API details, see RejectAttachment
in AWS CLI Command Reference.
-
The following code example shows how to use start-route-analysis
.
- AWS CLI
-
To start route analysis
The following
start-route-analysis
example starts the analysis between a source and destination, including the optionalinclude-return-path
.aws networkmanager start-route-analysis \ --global-network-id
global-network-00aa0aaa0b0aaa000
\ --sourceTransitGatewayAttachmentArn=arn:aws:ec2:us-east-1:503089527312:transit-gateway-attachment/tgw-attach-0d4a2d491bf68c093,IpAddress=10.0.0.0
\ --destinationTransitGatewayAttachmentArn=arn:aws:ec2:us-west-1:503089527312:transit-gateway-attachment/tgw-attach-002577f30bb181742,IpAddress=11.0.0.0
\ --include-return-pathOutput:
{ "RouteAnalysis": { "GlobalNetworkId": "global-network-00aa0aaa0b0aaa000 "OwnerAccountId": "1111222233333", "RouteAnalysisId": "a1873de1-273c-470c-1a2bc2345678", "StartTimestamp": 1695760154.0, "Status": "RUNNING", "Source": { "TransitGatewayAttachmentArn": "arn:aws:ec2:us-east-1:111122223333:transit-gateway-attachment/tgw-attach-1234567890abcdef0, "TransitGatewayArn": "arn:aws:ec2:us-east-1:111122223333:transit-gateway/tgw-abcdef01234567890", "IpAddress": "10.0.0.0" }, "Destination": { "TransitGatewayAttachmentArn": "arn:aws:ec2:us-west-1:555555555555:transit-gateway-attachment/tgw-attach-021345abcdef6789", "TransitGatewayArn": "arn:aws:ec2:us-west-1:111122223333:transit-gateway/tgw-09876543210fedcba0", "IpAddress": "11.0.0.0" }, "IncludeReturnPath": true, "UseMiddleboxes": false } }
For more information, see Route Analyzer in the AWS Global Networks for Transit Gateways User Guide.
-
For API details, see StartRouteAnalysis
in AWS CLI Command Reference.
-
The following code example shows how to use tag-resource
.
- AWS CLI
-
To apply tags to a resource
The following
tag-resource
example applies the tagNetwork=Northeast
to the devicedevice-07f6fd08867abc123
.aws networkmanager tag-resource \ --resource-arn
arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123
\ --tagsKey=Network,Value=Northeast
\ --regionus-west-2
This command produces no output.
-
For API details, see TagResource
in AWS CLI Command Reference.
-
The following code example shows how to use untag-resource
.
- AWS CLI
-
To remove tags from a resource
The following
untag-resource
example removes the tag with the keyNetwork
from the devicedevice-07f6fd08867abc123
.aws networkmanager untag-resource \ --resource-arn
arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123
]
--tag-keysNetwork
\ --regionus-west-2
This command produces no output.
-
For API details, see UntagResource
in AWS CLI Command Reference.
-
The following code example shows how to use update-device
.
- AWS CLI
-
To update a device
The following
update-device
example updates devicedevice-07f6fd08867abc123
by specifying a site ID for the device.aws networkmanager update-device \ --global-network-id
global-network-01231231231231231
\ --device-iddevice-07f6fd08867abc123
\ --site-idsite-444555aaabbb11223
\ --regionus-west-2
Output:
{ "Device": { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "NY office device", "Type": "Office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "SiteId": "site-444555aaabbb11223", "CreatedAt": 1575554005.0, "State": "UPDATING" } }
For more information, see Working with Devices in the Transit Gateway Network Manager Guide.
-
For API details, see UpdateDevice
in AWS CLI Command Reference.
-
The following code example shows how to use update-global-network
.
- AWS CLI
-
To update a global network
The following
update-global-network
example updates the description for global networkglobal-network-01231231231231231
.aws networkmanager update-global-network \ --global-network-id
global-network-01231231231231231
\ --description"Head offices"
\ --regionus-west-2
Output:
{ "GlobalNetwork": { "GlobalNetworkId": "global-network-01231231231231231", "GlobalNetworkArn": "arn:aws:networkmanager::123456789012:global-network/global-network-01231231231231231", "Description": "Head offices", "CreatedAt": 1575553525.0, "State": "UPDATING" } }
For more information, see Global Networks in the Transit Gateway Network Manager Guide.
-
For API details, see UpdateGlobalNetwork
in AWS CLI Command Reference.
-
The following code example shows how to use update-link
.
- AWS CLI
-
To update a link
The following
update-link
example updates the bandwidth information for linklink-11112222aaaabbbb1
.aws networkmanager update-link \ --global-network-id
global-network-01231231231231231
\ --link-idlink-11112222aaaabbbb1
\ --bandwidthUploadSpeed=20,DownloadSpeed=20
\ --regionus-west-2
Output:
{ "Link": { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 20, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "UPDATING" } }
For more information, see Working with Links in the Transit Gateway Network Manager Guide.
-
For API details, see UpdateLink
in AWS CLI Command Reference.
-
The following code example shows how to use update-site
.
- AWS CLI
-
To update a site
The following
update-site
example updates the description for sitesite-444555aaabbb11223
in the specified global network.aws networkmanager update-site \ --global-network-id
global-network-01231231231231231
\ --site-idsite-444555aaabbb11223
\ --description"New York Office site"
\ --regionus-west-2
Output:
{ "Site": { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York Office site", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554528.0, "State": "UPDATING" } }
For more information, see Working with Sites in the Transit Gateway Network Manager Guide.
-
For API details, see UpdateSite
in AWS CLI Command Reference.
-