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

documentation on how to synth, diff, and deploy from java without CLI #1133

Closed
dsilvasc opened this issue Nov 9, 2018 · 6 comments
Closed
Labels
feature-request A feature should be added or improved. language/java Related to Java bindings

Comments

@dsilvasc
Copy link

dsilvasc commented Nov 9, 2018

It would be nice to have documentation on the readme or elsewhere on how to synth, diff, and deploy stacks with library calls instead of the cdk cli. This is helpful when you're running from an IDE -- especially for debugging. It's also helpful for embedding synthesis and deployment in other processes.

For example, this seems to synthesize a template from scala:

object Demo extends App {
  val cdkApp = new software.amazon.awscdk.App
  val props = StackProps.builder
    .withEnv(
      Environment.builder
        .withRegion("us-east-1")
        .build)
    .build
  val stack = MyStack(cdkApp, "stack-name", props)
  val output = cdkApp.synthesizeStack(stack.getName)
  val template = output.getTemplate.asInstanceOf[java.util.Map[String, Object]]
  println(javaMapToYAML(template)) 
}

It would be helpful to have a page like https://awslabs.github.io/aws-cdk/tools.html but for the library, describing cdkApp.synthesizeStack and friends.

@eladb eladb added 📚 documentation language/java Related to Java bindings feature-request A feature should be added or improved. labels Dec 17, 2018
@thesurlydev
Copy link
Contributor

I keep coming back to this issue hoping it gets traction. This seems like it would be a huge benefit from the standpoint of using CDK for standing up and tearing down infrastructure for tests in any JVM language.

Is the current pattern to possibly use CDK to generate the template then use SDK to deploy, etc.?

@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 8, 2019

Yes, that is it.

There is something you could do; for example, you can call .toCloudFormation() on your stack, which nets you part of the template, but the more advanced features like assets won't work in that scenario. At the moment, you have to use the CDK toolkit to interact with your CDK app.

@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 8, 2019

Also a duplicate of https://github.com/awslabs/aws-cdk/issues/601, so closing this.

@rix0rrr rix0rrr closed this as completed Jan 8, 2019
@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 8, 2019

Please upvote the linked issue.

@geek29
Copy link

geek29 commented Aug 3, 2019

I have discovered that calling synth() on App from Java generates cloud assembly in the temp folder whereas using cdk commands gets that temp folder content into ./cdk.out directory. If you are looking for template file string you can go through /tmp/cdk.outxxxxxx location.

@eladb
Copy link
Contributor

eladb commented Aug 5, 2019

You can also specify outdir when you create the App instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. language/java Related to Java bindings
Projects
None yet
Development

No branches or pull requests

5 participants