Skip to content

Instantly share code, notes, and snippets.

@sakamaki-kazuyoshi
Last active January 28, 2022 12:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sakamaki-kazuyoshi/db6ef02d2ea6be1fb1ab09a0e0ffeb36 to your computer and use it in GitHub Desktop.
Save sakamaki-kazuyoshi/db6ef02d2ea6be1fb1ab09a0e0ffeb36 to your computer and use it in GitHub Desktop.
AWS再入門ブログリレー AWS Glue編
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
projectName:
Type: String
masterUsername:
Type: String
masterUserPassword:
NoEcho : true
Type: String
Resources:
vpc:
Type: 'AWS::EC2::VPC'
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsSupport: 'true'
EnableDnsHostnames: 'true'
InstanceTenancy: default
Tags:
- Key: Name
Value: !Sub ${projectName}-vpc
privateSubnet1:
Type: 'AWS::EC2::Subnet'
Properties:
VpcId: !Ref vpc
AvailabilityZone: 'ap-northeast-1a'
CidrBlock: 10.0.0.0/24
Tags:
- Key: Name
Value: !Sub ${projectName}-private-subnet01
privateRouteTable:
Type: 'AWS::EC2::RouteTable'
Properties:
VpcId: !Ref vpc
Tags:
- Key: Name
Value: !Sub ${projectName}-private-rtb
associatePrivateSubnet1ToPublicRouteTable:
Type: 'AWS::EC2::SubnetRouteTableAssociation'
Properties:
RouteTableId: !Ref privateRouteTable
SubnetId: !Ref privateSubnet1
vpcS3Endpoint:
Type: "AWS::EC2::VPCEndpoint"
Properties:
RouteTableIds:
- !Ref privateRouteTable
ServiceName: !Sub "com.amazonaws.${AWS::Region}.s3"
VpcId: !Ref vpc
redshiftSecuritygroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: !Sub ${projectName}-redshift-sg
GroupDescription: !Sub ${projectName}-redshift-sg
Tags:
- Key: Name
Value: !Sub ${projectName}-redshift-sg
VpcId: !Ref vpc
#循環参照のため
redshiftSecuritygroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: !Ref redshiftSecuritygroup
IpProtocol: tcp
FromPort: '0'
ToPort: '65535'
SourceSecurityGroupId: !Ref redshiftSecuritygroup
ClusterSubnetGroup:
Type: 'AWS::Redshift::ClusterSubnetGroup'
Properties:
Description: Redshift ClusterSubnetGroup
SubnetIds:
- !Ref privateSubnet1
Tags:
- Key: Name
Value: !Sub ${projectName}-redshift-subnetgroup
redshiftCluster:
Type: "AWS::Redshift::Cluster"
Properties:
ClusterIdentifier: !Sub ${projectName}-redshift
DBName: dev
ClusterSubnetGroupName: !Ref ClusterSubnetGroup
VpcSecurityGroupIds:
- !Ref redshiftSecuritygroup
MasterUsername: !Sub ${masterUsername}
MasterUserPassword: !Sub ${masterUserPassword}
NodeType: "dc2.large"
ClusterType: "single-node"
AutomatedSnapshotRetentionPeriod: 0
PubliclyAccessible: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment