# stacks/shared-vpc/gateway-endpoints.yml
AWSTemplateFormatVersion: "2010-09-09"

Description: Creates various Gateway VPC endpoints in the shared VPC

Parameters:
  VpcId: { Type: AWS::EC2::VPC::Id }
  PublicRouteTableId: { Type: String }
  PrivateRouteTableId: { Type: String }

# https://docs.aws.amazon.com/vpc/latest/userguide/vpce-gateway.html
Resources:
  S3Endpoint:
    Type: AWS::EC2::VPCEndpoint
    Properties:
      RouteTableIds:
        - !Ref PublicRouteTableId
        - !Ref PrivateRouteTableId
      ServiceName: !Sub com.amazonaws.${AWS::Region}.s3
      VpcEndpointType: Gateway
      VpcId: !Ref VpcId

# stacks/shared-vpc/gateway-endpoints.yml
AWSTemplateFormatVersion: "2010-09-09"

Description: Creates various Gateway VPC endpoints in the shared VPC

Parameters:
  VpcId: { Type: AWS::EC2::VPC::Id }
  PublicRouteTableId: { Type: String }
  PrivateRouteTableId: { Type: String }

# https://docs.aws.amazon.com/vpc/latest/userguide/vpce-gateway.html
Resources:
  S3Endpoint:
    Type: AWS::EC2::VPCEndpoint
    Properties:
      RouteTableIds:
        - !Ref PublicRouteTableId
        - !Ref PrivateRouteTableId
      ServiceName: !Sub com.amazonaws.${AWS::Region}.s3
      VpcEndpointType: Gateway
      VpcId: !Ref VpcId

  DynamoDbEndpoint:
    Type: AWS::EC2::VPCEndpoint
    Properties:
      RouteTableIds:
        - !Ref PublicRouteTableId
        - !Ref PrivateRouteTableId
      ServiceName: !Sub com.amazonaws.${AWS::Region}.dynamodb
      VpcEndpointType: Gateway
      VpcId: !Ref VpcId

Add DynamoDB VPC Endpoint for new VPC stack
Add DynamoDB VPC Endpoint for new VPC stack
