将 ReplaceNetworkAclAssociation 与 CLI 配合使用 - AWS SDK 代码示例

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

ReplaceNetworkAclAssociation 与 CLI 配合使用

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

CLI
AWS CLI

替换与子网关联的网络 ACL

此示例将指定的网络 ACL 与指定网络 ACL 关联的子网相关联。

命令:

aws ec2 replace-network-acl-association --association-id aclassoc-e5b95c8c --network-acl-id acl-5fb85d36

输出:

{ "NewAssociationId": "aclassoc-3999875b" }
PowerShell
Tools for PowerShell V4

示例 1:此示例将指定的网络 ACL 与指定网络 ACL 关联的子网相关联。

Set-EC2NetworkAclAssociation -NetworkAclId acl-12345678 -AssociationId aclassoc-1a2b3c4d

输出

aclassoc-87654321
Tools for PowerShell V5

示例 1:此示例将指定的网络 ACL 与指定网络 ACL 关联的子网相关联。

Set-EC2NetworkAclAssociation -NetworkAclId acl-12345678 -AssociationId aclassoc-1a2b3c4d

输出

aclassoc-87654321