在 Atlas VPC 和 Amazon Web Services VPC 之间创建网络对等连接。
network peering create 命令会检查您为 Atlas 项目指定的区域中是否存在 VPC。 如果存在,此命令会在该 VPC 和您的 VPC 之间创建对等互连。如果 Atlas VPC 不存在,此命令会创建一个 VPC,并在该 VPC 与您的 VPC 之间创建连接。
To learn more about network peering connections, see https://www.mongodb.com/zh-cn/docs/atlas/security-vpc-peering/.
要使用此命令,您必须使用具有“项目所有者”角色的用户帐户、服务帐户或API密钥进行身份验证。
语法
atlas networking peering create aws [options]
选项
名称 | 类型 | 必需 | 说明 |
|---|---|---|---|
--accountId | 字符串 | true | 拥有对等 VPC 的唯一的 12 位 AWS 账户 ID。 |
--atlasCidrBlock | 字符串 | false | Atlas用于项目中创建的所有网络对等连接的 CIDR区块。仅当您还没有Atlas VPC时才需要此选项。要学习;了解更多信息,请参阅Atlas用户界面标签页,网址为:https://dochub.mongodb.org/core/peering-connection-atlas。 |
-h,--help | false | Amazon Web Services 帮助 | |
-o, --output | 字符串 | false | 输出格式。 有效值为 json、json-path、go-template 或 go-template-file。 要查看完整输出,请使用 -o json 选项。 |
--projectId | 字符串 | false | 标识要使用的项目的十六进制字符串。 此选项会覆盖配置文件或环境变量中的设置。 |
--region | 字符串 | true | 与 Atlas VPC 对等互连的 VPC 所在的云提供商地区。 |
--routeTableCidrBlock | 字符串 | true | 对等互连 VPC CIDR 区块或子网。 |
--vpcId | 字符串 | true | 对等互连 VPC 的唯一标识符。 |
继承选项
名称 | 类型 | 必需 | 说明 |
|---|---|---|---|
-P, --profile | 字符串 | false | 要从您的配置文件中使用的配置文件的名称。要学习;了解Atlas CLI配置文件,请参阅 https://dochub.mongodb.org/core/atlas-cli-save-connection-settings. |
输出
如果命令成功,CLI 将返回类似于以下示例的输出。 括号中的值代表您的价值观。
Network peering connection '<Id>' created.
示例
# Create a network peering connection between the Atlas VPC in CIDR block 192.168.0.0/24 and your AWS VPC in CIDR block 10.0.0.0/24 for AWS account number 854333054055: atlas networking peering create aws --accountId 854333054055 --atlasCidrBlock 192.168.0.0/24 --region us-east-1 --routeTableCidrBlock 10.0.0.0/24 --vpcId vpc-078ac381aa90e1e63