-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
472 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
*.js | ||
!jest.config.js | ||
*.d.ts | ||
!types/*.d.ts | ||
node_modules | ||
|
||
# CDK asset staging directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#!/usr/bin/env node | ||
import { CdkWorkshopStack } from '../lib/cdk-workshop-stack' | ||
import cdk = require('@aws-cdk/core'); | ||
|
||
import * as cdk from '@aws-cdk/core' | ||
const app = new cdk.App() | ||
|
||
;(() => new CdkWorkshopStack(app, 'CdkWorkshopStack'))() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module.exports = { | ||
"roots": [ | ||
"<rootDir>/test" | ||
], | ||
testMatch: [ '**/*.test.ts'], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
roots: [ | ||
'<rootDir>/test' | ||
], | ||
testMatch: ['**/*.test.ts'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { CfnLoadBalancer, CfnListener } from '@aws-cdk/aws-elasticloadbalancingv2' | ||
import { ConstructProps } from '../../types/index' | ||
|
||
export default function ({ stack, scope, id, props }: ConstructProps, vpc: any, sg: any): void { | ||
// Alb | ||
const alb = new CfnLoadBalancer(stack, 'alb', { | ||
loadBalancerAttributes: [ | ||
{ | ||
key: 'idle_timeout.timeout_seconds', | ||
value: '60' | ||
} | ||
], | ||
scheme: 'internet-facing', | ||
// securityGroups: , | ||
subnets: [ // vpc.tsで定義したものを参照したい | ||
vpc., | ||
'10.0.2.0/24' | ||
] | ||
}) | ||
|
||
// Listener | ||
new CfnListener(stack, 'listener', { | ||
defaultActions: [ | ||
{ | ||
type: 'forward' | ||
// targetGroupArn: | ||
} | ||
], | ||
loadBalancerArn: alb.ref, | ||
port: 80, | ||
protocol: 'HTTP' | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { CfnSecurityGroup, CfnSecurityGroupIngress } from '@aws-cdk/aws-ec2' | ||
import { ConstructProps } from '../../types/index' | ||
// import genVpc from './vpc' | ||
|
||
export default function ({ stack, scope, id, props }: ConstructProps, vpc: any): void { | ||
// PublicAlbSg | ||
const publicAlbSg = new CfnSecurityGroup(stack, 'publicAlbSg', { | ||
groupDescription: 'SecurityGroup for Public ALB', | ||
securityGroupIngress: [ | ||
{ | ||
ipProtocol: 'tcp', | ||
cidrIp: '0.0.0.0/0', | ||
description: 'Enable HTTP access via port 80', | ||
fromPort: 80, | ||
toPort: 80 | ||
} | ||
], | ||
vpcId: vpc.ref | ||
}) | ||
|
||
// TargetFleetSg | ||
const targetFleetSg = new CfnSecurityGroup(stack, 'targetFleetSg', { | ||
groupDescription: 'SecurityGroup for Target Fleet', | ||
securityGroupIngress: [ | ||
{ | ||
ipProtocol: 'tcp', | ||
cidrIp: '0.0.0.0/0', | ||
description: 'Enable SSH access via port 22', | ||
fromPort: 22, | ||
toPort: 22 | ||
} | ||
], | ||
vpcId: vpc.ref | ||
}) | ||
|
||
new CfnSecurityGroupIngress(stack, 'targetFleetSgIngress1', { | ||
sourceSecurityGroupId: publicAlbSg.ref, | ||
description: 'Rule For HTTP Access From Public ALB', | ||
ipProtocol: 'tcp', | ||
fromPort: 80, | ||
toPort: 80, | ||
groupId: targetFleetSg.ref | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.