Amazon web services 在云形成中为SQS创建VPC接口端点
我想知道是否有可能在我的CloudFormation文件中创建一个资源来为SQS创建VPC端点。我能够为SQS和DynamoDB实现这一点,但我相信这是因为它们是网关端点 目前,我已将我的SQS资源定义为:Amazon web services 在云形成中为SQS创建VPC接口端点,amazon-web-services,amazon-cloudformation,amazon-vpc,Amazon Web Services,Amazon Cloudformation,Amazon Vpc,我想知道是否有可能在我的CloudFormation文件中创建一个资源来为SQS创建VPC端点。我能够为SQS和DynamoDB实现这一点,但我相信这是因为它们是网关端点 目前,我已将我的SQS资源定义为: SQSEndpoint: Type: AWS::EC2::VPCEndpoint Properties: PolicyDocument: Version: 2012-10-17 Statement: - Effe
SQSEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal: '*'
Action:
- 'sqs:*'
Resource:
- '*'
ServiceName: !Join
- ''
- - com.amazonaws.
- !Ref 'AWS::Region'
- .sqs
SubnetIds:
- !Ref PrivateSubnet
- !Ref PublicSubnet
VpcId: !Ref 'VPC'
VpcEndpointType: Interface
但是,当我尝试创建堆栈时,会出现以下错误:
从AWS的阅读来看,这似乎是可能的。尽管我找不到任何示例或文档。有什么想法吗?我想出来了,对于使用网关端点的DynamoDB和S3,必须定义
PolicyDocument
属性。对于所有其他服务,这不需要定义。因此,对于SQS,所需的是:
SQSEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Join
- ''
- - com.amazonaws.
- !Ref 'AWS::Region'
- .sqs
SubnetIds:
- !Ref PrivateSubnet
- !Ref PublicSubnet
VpcId: !Ref 'VPC'
VpcEndpointType: Interface
编辑:
仍然不起作用,即使设置了接口端点,我必须:
PrivateDnsEnabled
属性设置为true
,以便您可以在AWS CLI使用公共端点时使用AWS CLI,并且设置PrivateDnsEnabled
允许将私有端点自动映射到公共端点SecurityGroupsIds
设置为具有允许来自VPC的入站流量的安全组。如果设置了此实例,则使用默认安全组,它只允许来自具有默认安全组的源的入站流量,这意味着SQS
将无法将流量发送回您的实例 SQSEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Join
- ''
- - com.amazonaws.
- !Ref 'AWS::Region'
- .sqs
SubnetIds:
- !Ref PrivateSubnet
VpcId: !Ref 'VPC'
VpcEndpointType: Interface
SecurityGroupIds:
- !Ref PrivateSubnetInstanceSG # has to allow traffic from your VPC
PrivateDnsEnabled: true