@ndlib/ndlib-cdk2 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -382,7 +382,9 @@ new EC2withDatabase (app, 'StackName', {
382
382
  keyName: "libnd",
383
383
  privateIpAddress: "IPAddress",
384
384
  publicSubnetIds: [ "ValidSubnet in VPC" ],
385
- volumeSize: 50,
385
+ domainName: "Local domain name",
386
+ cnameList: [ Array of cnames/additional IPs to be added ],
387
+ volumeSize: Number (in GB),
386
388
  vpcId: "Valid VPC ID",
387
389
  sg_ingress_db: 'Security Group of database for access',
388
390
  sg_ingress_db_port: PortNumber,
@@ -19,6 +19,8 @@ export interface ServiceStackProps extends StackProps {
19
19
  readonly sg_ingress_rules: IIngress_Rule[];
20
20
  readonly sg_ingress_db: string;
21
21
  readonly sg_ingress_db_port: number;
22
+ readonly domainName: string;
23
+ readonly CnameList: string[];
22
24
  }
23
25
  export declare class EC2withDatabase extends Stack {
24
26
  constructor(scope: Construct, id: string, props: ServiceStackProps);
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EC2withDatabase = void 0;
4
4
  const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const aws_cdk_lib_2 = require("aws-cdk-lib");
6
+ const ssm = require("aws-cdk-lib/aws-ssm");
7
+ const aws_route53_1 = require("aws-cdk-lib/aws-route53");
5
8
  class EC2withDatabase extends aws_cdk_lib_1.Stack {
6
9
  constructor(scope, id, props) {
7
10
  super(scope, id, props);
@@ -16,7 +19,7 @@ class EC2withDatabase extends aws_cdk_lib_1.Stack {
16
19
  'us-east-1': props.amiId,
17
20
  });
18
21
  // Need to look up the role name and then get the ARN value
19
- const basic_role = aws_cdk_lib_1.aws_ssm.StringParameter.valueFromLookup(this, '/esu/ec2/basic_role_name');
22
+ const basic_role = ssm.StringParameter.valueFromLookup(this, '/esu/ec2/basic_role_name');
20
23
  const roleName = `arn:aws:iam::${this.account}:${basic_role}`;
21
24
  const ec2role = aws_cdk_lib_1.aws_iam.Role.fromRoleArn(this, 'Role', roleName);
22
25
  // Create a security group for this specific server using rules passed in
@@ -33,7 +36,7 @@ class EC2withDatabase extends aws_cdk_lib_1.Stack {
33
36
  ec2SecurityGroup.addIngressRule(aws_cdk_lib_1.aws_ec2.Peer.ipv4(rule.ipv4), aws_cdk_lib_1.aws_ec2.Port.tcp(rule.port), rule.description);
34
37
  });
35
38
  // With all of the information gathered, as well as values passed in, create the server
36
- new aws_cdk_lib_1.aws_ec2.Instance(this, 'ec2-server', {
39
+ const ec2_server = new aws_cdk_lib_1.aws_ec2.Instance(this, 'ec2-server', {
37
40
  blockDevices: [{
38
41
  deviceName: '/dev/xvda',
39
42
  volume: {
@@ -51,6 +54,50 @@ class EC2withDatabase extends aws_cdk_lib_1.Stack {
51
54
  instanceName: props.instanceName,
52
55
  privateIpAddress: props.privateIpAddress,
53
56
  });
57
+ const IPAddr = new aws_cdk_lib_1.aws_ec2.CfnEIP(this, 'Ip');
58
+ new aws_cdk_lib_1.aws_ec2.CfnEIPAssociation(this, 'Ec2Association', {
59
+ eip: IPAddr.ref,
60
+ instanceId: ec2_server.instanceId,
61
+ });
62
+ // Create DNS for libnd.nd.edu connection
63
+ const privateZoneId = ssm.StringParameter.fromStringParameterAttributes(this, 'PrivateZoneId', {
64
+ parameterName: `/all/dns/${props.keyName}/private/zoneId`,
65
+ }).stringValue;
66
+ new aws_route53_1.ARecord(this, 'PrivateARec', {
67
+ target: aws_route53_1.RecordTarget.fromIpAddresses(props.privateIpAddress),
68
+ recordName: props.instanceName,
69
+ zone: aws_route53_1.HostedZone.fromHostedZoneAttributes(this, 'PrivateHostedZone', {
70
+ hostedZoneId: privateZoneId,
71
+ zoneName: `${props.keyName}.nd.edu`,
72
+ }),
73
+ ttl: aws_cdk_lib_2.Duration.minutes(5),
74
+ });
75
+ // Create both Public and Private A records for library.nd.edu
76
+ for (const direction of ['public', 'private']) {
77
+ const hostedZoneId = ssm.StringParameter.fromStringParameterAttributes(this, `${direction}HostedZoneId`, {
78
+ parameterName: `/all/dns/${props.domainName}/${direction}/zoneId`,
79
+ }).stringValue;
80
+ new aws_route53_1.ARecord(this, `${direction}ServiceARec`, {
81
+ target: aws_route53_1.RecordTarget.fromIpAddresses(IPAddr.ref),
82
+ recordName: props.instanceName,
83
+ zone: aws_route53_1.HostedZone.fromHostedZoneAttributes(this, `${direction}ImportedHostedZone`, {
84
+ hostedZoneId: hostedZoneId,
85
+ zoneName: props.domainName,
86
+ }),
87
+ ttl: aws_cdk_lib_2.Duration.minutes(5),
88
+ });
89
+ props.CnameList.forEach(cname => {
90
+ new aws_route53_1.ARecord(this, `${direction}${cname}`, {
91
+ target: aws_route53_1.RecordTarget.fromIpAddresses(IPAddr.ref),
92
+ recordName: cname,
93
+ zone: aws_route53_1.HostedZone.fromHostedZoneAttributes(this, `${direction}${cname}HostedZone`, {
94
+ hostedZoneId: hostedZoneId,
95
+ zoneName: props.domainName,
96
+ }),
97
+ ttl: aws_cdk_lib_2.Duration.minutes(5),
98
+ });
99
+ });
100
+ }
54
101
  }
55
102
  }
56
103
  exports.EC2withDatabase = EC2withDatabase;
@@ -112,14 +112,9 @@ class StaticHost extends constructs_1.Construct {
112
112
  // Create DNS record (conditionally)
113
113
  if (props.createDns && props.hostedZoneTypes && props.hostedZoneTypes.length > 0) {
114
114
  for (const hostedZoneType of ['public', 'private']) {
115
- console.log('before if includes');
116
- console.log('hostedZoneType=', hostedZoneType);
117
- console.log('hostedZoneTypes = ', props.hostedZoneTypes);
118
115
  if (props.hostedZoneTypes.includes(hostedZoneType)) {
119
- console.log('getting hosted zone id for ', hostedZoneType);
120
116
  const hostedZoneIdPath = `/all/dns/${props.domainName}/${hostedZoneType}/zoneId`;
121
117
  const hostedZoneId = aws_ssm_1.StringParameter.valueForStringParameter(this, hostedZoneIdPath);
122
- console.log('hosted zone id = ', hostedZoneId);
123
118
  new aws_cdk_lib_1.aws_route53.CnameRecord(this, `ServiceCNAME${hostedZoneType}`, {
124
119
  recordName: this.hostname,
125
120
  comment: this.hostname,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/ndlib-cdk2",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Reusable CDK2 modules used within Hesburgh Libraries of Notre Dame",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -37,41 +37,40 @@
37
37
  },
38
38
  "homepage": "https://github.com/ndlib/ndlib-cdk2#readme",
39
39
  "peerDependencies": {
40
- "aws-cdk-lib": "^2.26.0",
41
- "constructs": "^10.1.25"
40
+ "aws-cdk-lib": "^2.41.0"
42
41
  },
43
42
  "devDependencies": {
44
- "@types/jest": "^28.1.0",
45
- "@types/node": "^17.0.38",
46
- "@typescript-eslint/eslint-plugin": "^5.27.0",
47
- "@typescript-eslint/parser": "^5.27.0",
48
- "aws-sdk": "^2.1147.0",
49
- "aws-sdk-client-mock": "^0.6.2",
50
- "eslint": "^8.16.0",
43
+ "@types/jest": "^29.0.2",
44
+ "@types/node": "^18.7.18",
45
+ "@typescript-eslint/eslint-plugin": "^5.37.0",
46
+ "@typescript-eslint/parser": "^5.37.0",
47
+ "aws-sdk": "^2.1215.0",
48
+ "aws-sdk-client-mock": "^2.0.0",
49
+ "eslint": "^8.23.1",
51
50
  "eslint-config-standard": "^17.0.0",
52
51
  "eslint-plugin-import": "^2.26.0",
53
- "eslint-plugin-jest": "^26.4.6",
54
- "eslint-plugin-n": "^15.2.1",
52
+ "eslint-plugin-jest": "^27.0.4",
53
+ "eslint-plugin-n": "^15.2.5",
55
54
  "eslint-plugin-node": "^11.1.0",
56
- "eslint-plugin-promise": "^6.0.0",
55
+ "eslint-plugin-promise": "^6.0.1",
57
56
  "eslint-plugin-standard": "^5.0.0",
58
57
  "github-changes": "^2.0.3",
59
- "jest": "^28.1.0",
60
- "prettier": "^2.6.2",
58
+ "jest": "^29.0.3",
59
+ "prettier": "^2.7.1",
61
60
  "subpackage": "^1.1.0",
62
- "ts-jest": "^28.0.3",
61
+ "ts-jest": "^29.0.1",
63
62
  "tsc-watch": "^5.0.3",
64
- "typescript": "^4.7.2"
63
+ "typescript": "^4.8.3"
65
64
  },
66
65
  "files": [
67
66
  "lib/**/*"
68
67
  ],
69
68
  "dependencies": {
70
- "@aws-cdk/aws-appsync-alpha": "^2.26.0-alpha.0",
71
- "aws-cdk-lib": "^2.26.0",
72
- "constructs": "^10.1.25",
73
- "jest-mock": "^28.1.0",
74
- "node-fetch": "^3.2.5"
69
+ "@aws-cdk/aws-appsync-alpha": "^2.41.0-alpha.0",
70
+ "aws-cdk-lib": "^2.41.0",
71
+ "constructs": "^10.1.102",
72
+ "jest-mock": "^29.0.3",
73
+ "node-fetch": "^3.2.10"
75
74
  },
76
75
  "subPackages": [
77
76
  "src/internal-lambdas/sourceWatcherLambda/src"
package/lib/.DS_Store DELETED
Binary file
Binary file
Binary file
Binary file
Binary file