我在CloudFormation中创建了一个堆栈,我需要帮助来改进它。在下面的堆栈中,我有一个,但是不可能两次创建它,也就是说,我不能有两个相同的服务名称。有没有人知道创建一个条件,如果创建了VPC,它就跳过了这个步骤?
VPCEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Join
- ''
- - com.amazonaws.
- !Ref 'AWS::Region'
- .execute-api
PrivateDnsEnabled: true
SecurityGroupIds:
- !Ref 9SecurityGroupId
SubnetIds:
Ref: 8SubnetIds
VpcEndpointType: Interface
VpcId:
Ref: 7VpcId
APIGateway:
Type: AWS::ApiGateway::RestApi
Properties:
Name: !Ref 1Name
EndpointConfiguration:
Types:
- PRIVATE
VpcEndpointIds:
- !Ref VPCEndpoint
Policy:
Statement:
- Action: 'execute-api:Invoke'
Effect: Allow
Principal: '*'
Resource: 'execute-api:/*'
- Action: 'execute-api:Invoke'
Condition:
StringNotEquals:
'aws:SourceVpce': !Ref VPCEndpoint
Effect: Deny
Principal: '*'
Resource: 'execute-api:/*'
Version: 2012-10-17发布于 2021-09-14 02:33:53
https://stackoverflow.com/questions/69171127
复制相似问题