Skip to content

Commit 9ee738f

Browse files
tbadlovTomDufall
authored andcommitted
fix: many updates to fix for CDK 0.36.0 (#62)
* Change @aws-cdk/cdk to @aws-cdk/core * change in typescript files as well * changed values for resoruce overrides * more updates to latest apis * more updates * added commet * more cleanup * updates to more files * static site patch * fix time * Update CONTRIBUTING.md - Update documentation to align version `0.36.0` Co-Authored-By: Tom Dufall <[email protected]> * fix instance type constructor to include a combincation of class and size * fix path resolution for fromAsset * nit cleanup * better definition of instane type * timeout to 300 seconds * change from AssetCode to Code * added cluster capacity for further investigation * added optional properities back * extra space * uncomment code for further investigation * added timeout duration
1 parent 5eda018 commit 9ee738f

File tree

35 files changed

+117
-99
lines changed

35 files changed

+117
-99
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Create a directory with a name that is descriptive of the resource type or workf
101101
},
102102
"dependencies": {
103103
...
104-
"@aws-cdk/cdk": "^0.23.0"
104+
"@aws-cdk/core": "^0.36.0"
105105
}
106106
}
107107
```

typescript/api-cors-lambda-crud-dynamodb/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import apigateway = require('@aws-cdk/aws-apigateway');
22
import dynamodb = require('@aws-cdk/aws-dynamodb');
33
import lambda = require('@aws-cdk/aws-lambda');
4-
import cdk = require('@aws-cdk/cdk');
4+
import cdk = require('@aws-cdk/core');
55

66
export class ApiLambdaCrudDynamoDBStack extends cdk.Stack {
77
constructor(app: cdk.App, id: string) {
@@ -10,15 +10,15 @@ export class ApiLambdaCrudDynamoDBStack extends cdk.Stack {
1010
const dynamoTable = new dynamodb.Table(this, 'items', {
1111
partitionKey: {
1212
name: 'itemId',
13-
type: dynamodb.AttributeType.String
13+
type: dynamodb.AttributeType.STRING
1414
},
1515
tableName: 'items'
1616
});
1717

1818
const getOneLambda = new lambda.Function(this, 'getOneItemFunction', {
1919
code: new lambda.AssetCode('src'),
2020
handler: 'get-one.handler',
21-
runtime: lambda.Runtime.NodeJS810,
21+
runtime: lambda.Runtime.NODEJS_8_10,
2222
environment: {
2323
TABLE_NAME: dynamoTable.tableName,
2424
PRIMARY_KEY: 'itemId'
@@ -28,7 +28,7 @@ export class ApiLambdaCrudDynamoDBStack extends cdk.Stack {
2828
const getAllLambda = new lambda.Function(this, 'getAllItemsFunction', {
2929
code: new lambda.AssetCode('src'),
3030
handler: 'get-all.handler',
31-
runtime: lambda.Runtime.NodeJS810,
31+
runtime: lambda.Runtime.NODEJS_8_10,
3232
environment: {
3333
TABLE_NAME: dynamoTable.tableName,
3434
PRIMARY_KEY: 'itemId'
@@ -38,7 +38,7 @@ export class ApiLambdaCrudDynamoDBStack extends cdk.Stack {
3838
const createOne = new lambda.Function(this, 'createItemFunction', {
3939
code: new lambda.AssetCode('src'),
4040
handler: 'create.handler',
41-
runtime: lambda.Runtime.NodeJS810,
41+
runtime: lambda.Runtime.NODEJS_8_10,
4242
environment: {
4343
TABLE_NAME: dynamoTable.tableName,
4444
PRIMARY_KEY: 'itemId'
@@ -48,7 +48,7 @@ export class ApiLambdaCrudDynamoDBStack extends cdk.Stack {
4848
const updateOne = new lambda.Function(this, 'updateItemFunction', {
4949
code: new lambda.AssetCode('src'),
5050
handler: 'update-one.handler',
51-
runtime: lambda.Runtime.NodeJS810,
51+
runtime: lambda.Runtime.NODEJS_8_10,
5252
environment: {
5353
TABLE_NAME: dynamoTable.tableName,
5454
PRIMARY_KEY: 'itemId'
@@ -58,7 +58,7 @@ export class ApiLambdaCrudDynamoDBStack extends cdk.Stack {
5858
const deleteOne = new lambda.Function(this, 'deleteItemFunction', {
5959
code: new lambda.AssetCode('src'),
6060
handler: 'delete-one.handler',
61-
runtime: lambda.Runtime.NodeJS810,
61+
runtime: lambda.Runtime.NODEJS_8_10,
6262
environment: {
6363
TABLE_NAME: dynamoTable.tableName,
6464
PRIMARY_KEY: 'itemId'
@@ -108,7 +108,7 @@ export function addCorsOptions(apiResource: apigateway.IResource) {
108108
'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE'",
109109
},
110110
}],
111-
passthroughBehavior: apigateway.PassthroughBehavior.Never,
111+
passthroughBehavior: apigateway.PassthroughBehavior.NEVER,
112112
requestTemplates: {
113113
"application/json": "{\"statusCode\": 200}"
114114
},

typescript/api-cors-lambda-crud-dynamodb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"@aws-cdk/aws-apigateway": "*",
2222
"@aws-cdk/aws-dynamodb": "*",
2323
"@aws-cdk/aws-lambda": "*",
24-
"@aws-cdk/cdk": "*"
24+
"@aws-cdk/core": "*"
2525
}
2626
}

typescript/application-load-balancer/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import autoscaling = require('@aws-cdk/aws-autoscaling');
33
import ec2 = require('@aws-cdk/aws-ec2');
44
import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2');
5-
import cdk = require('@aws-cdk/cdk');
5+
import cdk = require('@aws-cdk/core');
66

77
class LoadBalancerStack extends cdk.Stack {
88
constructor(app: cdk.App, id: string) {
@@ -12,7 +12,7 @@ class LoadBalancerStack extends cdk.Stack {
1212

1313
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
1414
vpc,
15-
instanceType: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Micro),
15+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO),
1616
machineImage: new ec2.AmazonLinuxImage(),
1717
});
1818

typescript/application-load-balancer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"@aws-cdk/aws-autoscaling": "*",
2323
"@aws-cdk/aws-ec2": "*",
2424
"@aws-cdk/aws-elasticloadbalancingv2": "*",
25-
"@aws-cdk/cdk": "*"
25+
"@aws-cdk/core": "*"
2626
}
2727
}

typescript/appsync-graphql-dynamodb/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import cdk = require('@aws-cdk/cdk');
1+
import cdk = require('@aws-cdk/core');
22
import { CfnGraphQLApi, CfnApiKey, CfnGraphQLSchema, CfnDataSource, CfnResolver } from '@aws-cdk/aws-appsync';
33
import { Table, AttributeType, StreamViewType, BillingMode } from '@aws-cdk/aws-dynamodb';
4-
import { Role, ServicePrincipal } from '@aws-cdk/aws-iam';
4+
import { Role, ServicePrincipal, ManagedPolicy } from '@aws-cdk/aws-iam';
55

66

77
export class AppSyncCdkStack extends cdk.Stack {
@@ -17,11 +17,11 @@ export class AppSyncCdkStack extends cdk.Stack {
1717
});
1818

1919
new CfnApiKey(this, 'ItemsApiKey', {
20-
apiId: itemsGraphQLApi.graphQlApiApiId
20+
apiId: itemsGraphQLApi.attrApiId
2121
});
2222

2323
const apiSchema = new CfnGraphQLSchema(this, 'ItemsSchema', {
24-
apiId: itemsGraphQLApi.graphQlApiApiId,
24+
apiId: itemsGraphQLApi.attrApiId,
2525
definition: `type ${tableName} {
2626
${tableName}Id: ID!
2727
name: String
@@ -48,20 +48,20 @@ export class AppSyncCdkStack extends cdk.Stack {
4848
tableName: tableName,
4949
partitionKey: {
5050
name: `${tableName}Id`,
51-
type: AttributeType.String
51+
type: AttributeType.STRING
5252
},
53-
billingMode: BillingMode.PayPerRequest,
54-
streamSpecification: StreamViewType.NewImage
53+
billingMode: BillingMode.PAY_PER_REQUEST,
54+
stream: StreamViewType.NEW_IMAGE
5555
});
5656

5757
const itemsTableRole = new Role(this, 'ItemsDynamoDBRole', {
5858
assumedBy: new ServicePrincipal('appsync.amazonaws.com')
5959
});
6060

61-
itemsTableRole.attachManagedPolicy('arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess');
61+
itemsTableRole.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName('arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess'));
6262

6363
const dataSource = new CfnDataSource(this, 'ItemsDataSource', {
64-
apiId: itemsGraphQLApi.graphQlApiApiId,
64+
apiId: itemsGraphQLApi.attrApiId,
6565
name: 'ItemsDynamoDataSource',
6666
type: 'AMAZON_DYNAMODB',
6767
dynamoDbConfig: {
@@ -72,10 +72,10 @@ export class AppSyncCdkStack extends cdk.Stack {
7272
});
7373

7474
const getOneResolver = new CfnResolver(this, 'GetOneQueryResolver', {
75-
apiId: itemsGraphQLApi.graphQlApiApiId,
75+
apiId: itemsGraphQLApi.attrApiId,
7676
typeName: 'Query',
7777
fieldName: 'getOne',
78-
dataSourceName: dataSource.dataSourceName,
78+
dataSourceName: dataSource.name,
7979
requestMappingTemplate: `{
8080
"version": "2017-02-28",
8181
"operation": "GetItem",
@@ -88,10 +88,10 @@ export class AppSyncCdkStack extends cdk.Stack {
8888
getOneResolver.addDependsOn(apiSchema);
8989

9090
const getAllResolver = new CfnResolver(this, 'GetAllQueryResolver', {
91-
apiId: itemsGraphQLApi.graphQlApiApiId,
91+
apiId: itemsGraphQLApi.attrApiId,
9292
typeName: 'Query',
9393
fieldName: 'all',
94-
dataSourceName: dataSource.dataSourceName,
94+
dataSourceName: dataSource.name,
9595
requestMappingTemplate: `{
9696
"version": "2017-02-28",
9797
"operation": "Scan",
@@ -103,10 +103,10 @@ export class AppSyncCdkStack extends cdk.Stack {
103103
getAllResolver.addDependsOn(apiSchema);
104104

105105
const saveResolver = new CfnResolver(this, 'SaveMutationResolver', {
106-
apiId: itemsGraphQLApi.graphQlApiApiId,
106+
apiId: itemsGraphQLApi.attrApiId,
107107
typeName: 'Mutation',
108108
fieldName: 'save',
109-
dataSourceName: dataSource.dataSourceName,
109+
dataSourceName: dataSource.name,
110110
requestMappingTemplate: `{
111111
"version": "2017-02-28",
112112
"operation": "PutItem",
@@ -122,10 +122,10 @@ export class AppSyncCdkStack extends cdk.Stack {
122122
saveResolver.addDependsOn(apiSchema);
123123

124124
const deleteResolver = new CfnResolver(this, 'DeleteMutationResolver', {
125-
apiId: itemsGraphQLApi.graphQlApiApiId,
125+
apiId: itemsGraphQLApi.attrApiId,
126126
typeName: 'Mutation',
127127
fieldName: 'delete',
128-
dataSourceName: dataSource.dataSourceName,
128+
dataSourceName: dataSource.name,
129129
requestMappingTemplate: `{
130130
"version": "2017-02-28",
131131
"operation": "DeleteItem",

typescript/appsync-graphql-dynamodb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"@aws-cdk/aws-appsync": "*",
2222
"@aws-cdk/aws-dynamodb": "*",
2323
"@aws-cdk/aws-iam": "*",
24-
"@aws-cdk/cdk": "*"
24+
"@aws-cdk/core": "*"
2525
}
2626
}

typescript/classic-load-balancer/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import autoscaling = require('@aws-cdk/aws-autoscaling');
33
import ec2 = require('@aws-cdk/aws-ec2');
44
import elb = require('@aws-cdk/aws-elasticloadbalancing');
5-
import cdk = require('@aws-cdk/cdk');
5+
import cdk = require('@aws-cdk/core');
66

77
class LoadBalancerStack extends cdk.Stack {
88
constructor(app: cdk.App, id: string) {
@@ -12,7 +12,7 @@ class LoadBalancerStack extends cdk.Stack {
1212

1313
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
1414
vpc,
15-
instanceType: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Micro),
15+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO),
1616
machineImage: new ec2.AmazonLinuxImage(),
1717
});
1818

typescript/classic-load-balancer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"@aws-cdk/aws-autoscaling": "*",
2323
"@aws-cdk/aws-ec2": "*",
2424
"@aws-cdk/aws-elasticloadbalancing": "*",
25-
"@aws-cdk/cdk": "*"
25+
"@aws-cdk/core": "*"
2626
}
2727
}

typescript/custom-resource/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cdk = require('@aws-cdk/cdk');
1+
import cdk = require('@aws-cdk/core');
22
import { MyCustomResource } from './my-custom-resource';
33

44
/**

0 commit comments

Comments
 (0)