Reputation: 4348
I'm trying to follow the official tutorial: https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html
I picked Java but tried Typescript too with the same result: the S3 bucket resource template isn't produced and the deploy doesn't create the bucket.
The code is here: https://github.com/jumarko/aws-experiments/tree/master/cdk/hello-cdk-java
The cdk synth
command produces only this CDKMetadata
and nothing else:
cd hello-cdk-java
cdk init app --language java
mvn compile
cdk ls
# modify the stack java code
...
# this for some reason only outputs Metadata for me
# even `mvn clean package` doesn't help
cdk synth
Resources:
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Modules: aws-cdk=1.61.1,@aws-cdk/cloud-assembly-schema=1.61.1,@aws-cdk/core=1.61.1,@aws-cdk/cx-api=1.61.1,jsii-runtime=Java/14.0.1
Condition: CDKMetadataAvailable
Conditions:
CDKMetadataAvailable:
Fn::Or:
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- ap-east-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-2
- Fn::Equals:
- Ref: AWS::Region
- ap-south-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-2
- Fn::Equals:
- Ref: AWS::Region
- ca-central-1
- Fn::Equals:
- Ref: AWS::Region
- cn-north-1
- Fn::Equals:
- Ref: AWS::Region
- cn-northwest-1
- Fn::Equals:
- Ref: AWS::Region
- eu-central-1
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- eu-north-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-2
- Fn::Equals:
- Ref: AWS::Region
- eu-west-3
- Fn::Equals:
- Ref: AWS::Region
- me-south-1
- Fn::Equals:
- Ref: AWS::Region
- sa-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-2
- Fn::Equals:
- Ref: AWS::Region
- us-west-1
- Fn::Equals:
- Ref: AWS::Region
- us-west-2
Any clue on what's going on or how to debug the issue?
I'm using Mac OS X 10.15.6 with the following CLI versions:
$ aws --version
aws-cli/2.0.10 Python/3.8.2 Darwin/19.6.0 botocore/2.0.0dev14
$ cdk --version
1.61.1 (build 347918f)
Upvotes: 2
Views: 2017
Reputation: 1
I had the same issue, realised the problem was that I'd made a separate .py file for my code and cdk synth was looking at the empty app.py
Upvotes: 0
Reputation: 11367
I had a similar issue with the JavaScript CDK. When I executed:
npx cdk synth
I didn't get any output.
The problem was that I had initiated CDK in a folder named cdk:
mkdir cdk
cd cdk
npx cdk init app --language=javascript
This created a bin/cdk.js
file. This filename caused a conflict with the CDK library.
To resolve this, simply renamed the bin/cdk.js
file and updated its reference in cdk.json
.
Upvotes: 1
Reputation: 4348
I generated a new project from the template and it suddenly started to work.
I'm not sure what changed - I also experimented with using different --profile
but at first that didn't work either.
The issue is solved now - if something goes wrong it's worth starting from scratch again!
Upvotes: 1