Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network constructを修正 #21

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions infrastructure/lib/constructs/Network/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export class Network extends Construct {

// VPCを作成
this.vpc = new ec2.Vpc(this, "Vpc", {
natGateways: 0,
//natGateways: 0,
createInternetGateway: true,
maxAzs: 2,
subnetConfiguration: [
{
cidrMask: 24,
name: "Public",
subnetType: ec2.SubnetType.PUBLIC,
},
],
//subnetConfiguration: [
// {
// cidrMask: 24,
// name: "Public",
// subnetType: ec2.SubnetType.PUBLIC,
// },
//],
});

// VPCエンドポイントを作成
Expand Down
29 changes: 14 additions & 15 deletions infrastructure/lib/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as cdk from "aws-cdk-lib";
import { Construct } from "constructs";
//import { Network } from "./constructs/Network";
import { Network } from "./constructs/Network";
//import { ECS } from "./constructs/ECS";
import * as ec2 from "aws-cdk-lib/aws-ec2";
import { ApplicationLoadBalancedFargateService } from "aws-cdk-lib/aws-ecs-patterns";
import * as ecs from "aws-cdk-lib/aws-ecs";
import { NagSuppressions } from "cdk-nag";
Expand All @@ -16,14 +15,14 @@ export class Cobol4JAwsWebStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

//const network = new Network(this, "Network");
const network = new Network(this, "Network");

//this.ecsCluster = new ECS(this, "ECS", {
// vpc: network.vpc,
//});
const vpc = new ec2.Vpc(this, "MyVpc", { maxAzs: 2 });
//const vpc = new ec2.Vpc(this, "MyVpc", { maxAzs: 2 });
const cluster = new ecs.Cluster(this, "Cluster", {
vpc,
vpc: network.vpc,
containerInsights: true,
});

Expand All @@ -41,16 +40,16 @@ export class Cobol4JAwsWebStack extends cdk.Stack {
*/
public addCdkNagSuppressions() {
//this.ecsCluster.addCdkNagSuppressions(this);
NagSuppressions.addResourceSuppressionsByPath(
this,
"/StartCDKStack/MyVpc/Resource",
[
{
id: "AwsSolutions-VPC7",
reason: "VPC Flow Logsを作成していない",
},
],
);
//NagSuppressions.addResourceSuppressionsByPath(
// this,
// "/StartCDKStack/MyVpc/Resource",
// [
// {
// id: "AwsSolutions-VPC7",
// reason: "VPC Flow Logsを作成していない",
// },
// ],
//);
NagSuppressions.addResourceSuppressionsByPath(
this,
"/StartCDKStack/FargateService/LB/SecurityGroup/Resource",
Expand Down