Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. AWSTemplateFormatVersion: '2010-09-09'
  2. Parameters:
  3. projectName:
  4. Type: String
  5. masterUsername:
  6. Type: String
  7. masterUserPassword:
  8. NoEcho : true
  9. Type: String
  10. Resources:
  11. vpc:
  12. Type: 'AWS::EC2::VPC'
  13. Properties:
  14. CidrBlock: 10.0.0.0/16
  15. EnableDnsSupport: 'true'
  16. EnableDnsHostnames: 'true'
  17. InstanceTenancy: default
  18. Tags:
  19. - Key: Name
  20. Value: !Sub ${projectName}-vpc
  21. privateSubnet1:
  22. Type: 'AWS::EC2::Subnet'
  23. Properties:
  24. VpcId: !Ref vpc
  25. AvailabilityZone: 'ap-northeast-1a'
  26. CidrBlock: 10.0.0.0/24
  27. Tags:
  28. - Key: Name
  29. Value: !Sub ${projectName}-private-subnet01
  30. privateRouteTable:
  31. Type: 'AWS::EC2::RouteTable'
  32. Properties:
  33. VpcId: !Ref vpc
  34. Tags:
  35. - Key: Name
  36. Value: !Sub ${projectName}-private-rtb
  37. associatePrivateSubnet1ToPublicRouteTable:
  38. Type: 'AWS::EC2::SubnetRouteTableAssociation'
  39. Properties:
  40. RouteTableId: !Ref privateRouteTable
  41. SubnetId: !Ref privateSubnet1
  42. vpcS3Endpoint:
  43. Type: "AWS::EC2::VPCEndpoint"
  44. Properties:
  45. RouteTableIds:
  46. - !Ref privateRouteTable
  47. ServiceName: !Sub "com.amazonaws.${AWS::Region}.s3"
  48. VpcId: !Ref vpc
  49. redshiftSecuritygroup:
  50. Type: AWS::EC2::SecurityGroup
  51. Properties:
  52. GroupName: !Sub ${projectName}-redshift-sg
  53. GroupDescription: !Sub ${projectName}-redshift-sg
  54. Tags:
  55. - Key: Name
  56. Value: !Sub ${projectName}-redshift-sg
  57. VpcId: !Ref vpc
  58. #循環参照のため
  59. redshiftSecuritygroupIngress:
  60. Type: AWS::EC2::SecurityGroupIngress
  61. Properties:
  62. GroupId: !Ref redshiftSecuritygroup
  63. IpProtocol: tcp
  64. FromPort: '0'
  65. ToPort: '65535'
  66. SourceSecurityGroupId: !Ref redshiftSecuritygroup
  67. ClusterSubnetGroup:
  68. Type: 'AWS::Redshift::ClusterSubnetGroup'
  69. Properties:
  70. Description: Redshift ClusterSubnetGroup
  71. SubnetIds:
  72. - !Ref privateSubnet1
  73. Tags:
  74. - Key: Name
  75. Value: !Sub ${projectName}-redshift-subnetgroup
  76. redshiftCluster:
  77. Type: "AWS::Redshift::Cluster"
  78. Properties:
  79. ClusterIdentifier: !Sub ${projectName}-redshift
  80. DBName: dev
  81. ClusterSubnetGroupName: !Ref ClusterSubnetGroup
  82. VpcSecurityGroupIds:
  83. - !Ref redshiftSecuritygroup
  84. MasterUsername: !Sub ${masterUsername}
  85. MasterUserPassword: !Sub ${masterUserPassword}
  86. NodeType: "dc2.large"
  87. ClusterType: "single-node"
  88. AutomatedSnapshotRetentionPeriod: 0
  89. PubliclyAccessible: false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement