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

issue while Creating an Amazon RDS Database #1759

Closed
Vandivier opened this issue Feb 14, 2019 · 4 comments
Closed

issue while Creating an Amazon RDS Database #1759

Vandivier opened this issue Feb 14, 2019 · 4 comments

Comments

@Vandivier
Copy link

Vandivier commented Feb 14, 2019

start like #1758

  1. create new empty repo and clone locally
  2. cdk init app --language=typescript
  3. Receive "cdk init cannot be run in a non-empty directory!"
  4. mkdir cdk, cd cdk, then repeat step 2
  5. Creation succeeds. Now, cdk list
  6. Receive Error: Cannot find module ... \cdk\bin\cdk.js'.

Additional details:

  1. using git bash on windows 7.
  2. cdk --version: 0.24.1 (build 67fcf6d)
  3. node --version: 11.1.0
@Vandivier
Copy link
Author

This issue doesn't occur as described above. After step 4, creation succeeds, before cdk list, create /cdk/lib/test.ts and paste the content of the Creating an Amazon RDS Database starter. Now receive the noted error.

Remove /cdk/lib/test.ts and the error is eliminated. npm run build and receive informative errors @aws-cdk/aws-ec2, and similar. Install required dependencies and cdk list will neither fail nor mention the rds starter stack. Running npm run build in this state still results in a different error:

image

Let me know if this behavior is expected and close if appropriate. Issue renamed based on resolution of the cdk.js concern.

@Vandivier Vandivier changed the title cannot find cdk.js in new install issue while Creating an Amazon RDS Database Feb 14, 2019
@Vandivier
Copy link
Author

Errors shown above were silenced by updating Creating an Amazon RDS Database code to what is shown below. Notice that after silencing errors, cdk list still does not mention the now-compiling stack:

// ref: https://awslabs.github.io/aws-cdk/versions/0.8.2/examples.html#creating-an-rds-database

import ec2 = require('@aws-cdk/aws-ec2');
import rds = require('@aws-cdk/aws-rds');
import cdk = require('@aws-cdk/cdk');

class MyStack extends cdk.Stack {
  constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
    super(parent, name, props);

    const vpc = new ec2.VpcNetwork(this, 'VPC');

    new rds.DatabaseCluster(this, 'MyRdsDb', {
      defaultDatabaseName: 'MyAuroraDatabase',
      masterUser: {
        username: 'admin',
        password: '123456',
      },
      engine: rds.DatabaseClusterEngine.Aurora,
      instanceProps: {
        instanceType: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small),
        vpc: vpc,
        vpcPlacement: {
          subnetsToUse: ec2.SubnetType.Public,
        },
      },
    });
  }
}

const app = new cdk.App();

new MyStack(app, 'MyStack');

app.run()

@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 14, 2019

For some reason you've found the documentation to the 0.8.2 version of the CDK:

https://awslabs.github.io/aws-cdk/versions/0.8.2/examples.html#creating-an-rds-database

CDK has changed a lot in the mean time. Have a look at the latest RDS examples:

https://github.com/awslabs/aws-cdk/blob/master/packages/@aws-cdk/aws-rds/test/integ.cluster.ts

@Vandivier
Copy link
Author

Thanks! Will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants