简体   繁体   English

AWS 跨区域 VPC 对等互连 Cloudformation 无法识别其他区域中的 VPC

[英]AWS Cross-Region VPC Peering Cloudformation doesn't recognise the VPC in the other region

I have been working on creating a VPC Peering Connection that can peer from eu-west-1 to us-east-1 with the use of a cloudformation.我一直致力于创建一个 VPC 对等连接,该连接可以使用 cloudformation 从 eu-west-1 对等到 us-east-1。 This is the cloudformation as of right now:这是目前的云形成:

AWSTemplateFormatVersion: 2010-09-09
Description: This templates creates a VPC Peering connection. (Requester Account)

Parameters:
  PeerName:
    Description: Name of the VPC Peer
    MaxLength: 255
    Type: String
  PeerVPCID:
    AllowedPattern: '^vpc-[0-9a-f]{17}$'
    ConstraintDescription: Must have a prefix of "vpc-". Followed by 17 characters (numbers, letters "a-f")
    Description: ID of the VPC with which you are creating the VPC peering connection
    Type: AWS::EC2::VPC::Id
  VPCID:
    Description: ID of the VPC
    Type: AWS::EC2::VPC::Id
  PeerRegion:
    Description: Region of the VPC Accepter (not required)
    Type: String

Resources:
  VPCPeeringConnection:
    Type: AWS::EC2::VPCPeeringConnection
    Properties:
      VpcId: !Ref VPCID
      PeerVpcId: !Ref PeerVPCID
      PeerOwnerId: !Ref "AWS::AccountId"
      PeerRegion: !Ref PeerRegion
      Tags:
        - Key: Name
          Value: !Ref PeerName

Outputs:
  VPCPeeringConnectionId:
    Description: VPC Peering Connection ID
    Value: !Ref VPCPeeringConnection

These are the values for the parameters:这些是参数的值:

PeerName: Connector
PeerVPCID: vpc-1234567
VPCID: vpc-7654321
PeerRegion: us-east-1

I understand that I need an accepter that approves the connection in us-east-1, but the current cloudformation outputs that it doesn't recognise the VPCID to be valid (the one that is in the other region to the AWS account I'm using).我知道我需要一个接受者来批准 us-east-1 中的连接,但是当前的 cloudformation 输出它不能识别 VPCID 是有效的(另一个区域中的那个到我的 AWS 账户使用)。

When, I create the VPC Peering Connection in the GUI it throws no errors, I just have to accept the connection and update the route tables, which all work fine... is there something I should be doing with the current cloudformation?当我在 GUI 中创建 VPC 对等连接时,它不会引发任何错误,我只需要接受连接并更新路由表,一切正常......我应该对当前的 cloudformation 做些什么吗?

Thanks for any help!谢谢你的帮助!

To solve that change:为了解决这个变化:

 Type: AWS::EC2::VPC::Id

into进入

 Type: String

for the remote VPC, ie the VPC from a region other then where you deploy your stack.对于远程 VPC,即来自您部署堆栈的区域以外的 VPC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM