Deploy CDK project

First run cdk diff to take a look at the changes that are going to be deployed.

cdk diff

The CDK CLI requires you to be in the same directory as your cdk.json file.

The output should look like this:

Stack NorthwindCdkStack
Security Group Changes
┌───┬───────────────────────────────────────────┬─────┬─────────────┬────────────────────┐
│   │ Group                                     │ Dir │ Protocol    │ Peer               │
├───┼───────────────────────────────────────────┼─────┼─────────────┼────────────────────┤
│ + │ ${NorthwindDatabaseSecurityGroup.GroupId} │ In  │ TCP 1433    │ 34.255.215.58/32   │
│ + │ ${NorthwindDatabaseSecurityGroup.GroupId} │ Out │ ICMP 252-86 │ 255.255.255.255/32 │
└───┴───────────────────────────────────────────┴─────┴─────────────┴────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Resources
[+] AWS::EC2::SecurityGroup NorthwindDatabaseSecurityGroup NorthwindDatabaseSecurityGroup0267A879
[+] AWS::RDS::DBSubnetGroup NorthwindSQLServer/SubnetGroup NorthwindSQLServerSubnetGroup107ABEB4
[+] AWS::RDS::DBInstance NorthwindSQLServer NorthwindSQLServerB034B5AC

Outputs
[+] Output SQLServerEndpointAddress SQLServerEndpointAddress: {"Value":{"Fn::GetAtt":["NorthwindSQLServerB034B5AC","Endpoint.Address"]}}

As you can see, Security Group, Database Subnet Group and Database Instance are going to be created.

Now it’s time to deploy the project using cdk deploy command.

cdk deploy

As you will create security group and open port 1433, CDK will ask you to confirm these modifications.

This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

Security Group Changes
┌───┬───────────────────────────────────────────┬─────┬─────────────┬────────────────────┐
│   │ Group                                     │ Dir │ Protocol    │ Peer               │
├───┼───────────────────────────────────────────┼─────┼─────────────┼────────────────────┤
│ + │ ${NorthwindDatabaseSecurityGroup.GroupId} │ In  │ TCP 1433    │ 34.255.215.58/32   │
│ + │ ${NorthwindDatabaseSecurityGroup.GroupId} │ Out │ ICMP 252-86 │ 255.255.255.255/32 │
└───┴───────────────────────────────────────────┴─────┴─────────────┴────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Do you wish to deploy these changes (y/n)? y

It takes about 10 minutes to create RDS SQL Server database. So you can proceed to the next Lab and configure the application.

Once deployment is complete, you will se the following output:

NorthwindCdkStack: deploying...
NorthwindCdkStack: creating CloudFormation changeset...
 0/5 | 6:35:45 AM | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroup               | NorthwindDatabaseSecurityGroup (NorthwindDatabaseSecurityGroup0267A879)
 0/5 | 6:35:45 AM | CREATE_IN_PROGRESS   | AWS::RDS::DBSubnetGroup               | NorthwindSQLServer/SubnetGroup (NorthwindSQLServerSubnetGroup107ABEB4)
 0/5 | 6:35:46 AM | UPDATE_IN_PROGRESS   | AWS::CDK::Metadata                    | CDKMetadata
 0/5 | 6:35:46 AM | CREATE_IN_PROGRESS   | AWS::RDS::DBSubnetGroup               | NorthwindSQLServer/SubnetGroup (NorthwindSQLServerSubnetGroup107ABEB4) Resource creation Initiated
 1/5 | 6:35:47 AM | UPDATE_COMPLETE      | AWS::CDK::Metadata                    | CDKMetadata
 2/5 | 6:35:47 AM | CREATE_COMPLETE      | AWS::RDS::DBSubnetGroup               | NorthwindSQLServer/SubnetGroup (NorthwindSQLServerSubnetGroup107ABEB4)
 2/5 | 6:35:50 AM | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroup               | NorthwindDatabaseSecurityGroup (NorthwindDatabaseSecurityGroup0267A879) Resource creation Initiated
 3/5 | 6:35:52 AM | CREATE_COMPLETE      | AWS::EC2::SecurityGroup               | NorthwindDatabaseSecurityGroup (NorthwindDatabaseSecurityGroup0267A879)
 3/5 | 6:35:53 AM | CREATE_IN_PROGRESS   | AWS::RDS::DBInstance                  | NorthwindSQLServer (NorthwindSQLServerB034B5AC)
 3/5 | 6:35:56 AM | CREATE_IN_PROGRESS   | AWS::RDS::DBInstance                  | NorthwindSQLServer (NorthwindSQLServerB034B5AC) Resource creation Initiated
 3/5 Currently in progress: NorthwindSQLServerB034B5AC
 4/5 | 6:43:03 AM | CREATE_COMPLETE      | AWS::RDS::DBInstance                  | NorthwindSQLServer (NorthwindSQLServerB034B5AC)
 4/5 | 6:43:05 AM | UPDATE_COMPLETE_CLEA | AWS::CloudFormation::Stack            | NorthwindCdkStack

 ✅  NorthwindCdkStack

Outputs:
NorthwindCdkStack.SQLServerEndpointAddress = northwind-sqlserver.cyhlwzws5aoz.eu-west-1.rds.amazonaws.com

Stack ARN:
arn:aws:cloudformation:eu-west-1:404486542784:stack/NorthwindCdkStack/f78fb1c0-8ed1-11ea-8a83-0a0af0d573f8

Please note the Amazon RDS SQL Server endpoint address northwind-sqlserver.cyhlwzws5aoz.eu-west-1.rds.amazonaws.com as you will need it to update connection string.