question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cdk python document mixed with Node.js code example

See original GitHub issue

🐛 Bug Report

What is the problem?

Python document mixed with node.js code. For example, construct a new Vpc:

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ec2/Vpc.html

import { SubnetType, Vpc } from '@aws-cdk/aws-ec2'

const vpc = new Vpc(this, 'TheVPC', {
   cidr: "10.0.0.0/16"
})

// Iterate the private subnets
const selection = vpc.selectSubnets({
   subnetType: SubnetType.PRIVATE
});

for (const subnet of selection.subnets) {
   // ...
}

This is node.js / typescript code, not python code.

Advanced Subnet Configuration Connection Peers …

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ec2.README.html

Amazon ECR Construct Library

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ecr.README.html

Reproduction Steps

Simple. For Vpc, in CLI do this:

$ python
>>> from aws_cdk.aws_ec2 import Vpc
>>> help(Vpc)

Environment

  • CDK CLI Version:1.8.0 (build 5244f97)
  • OS:OSX Mojave
  • Language:Python

Original link for issue: https://github.com/aws-samples/aws-cdk-examples/issues/119

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rix0rrrcommented, Sep 17, 2019

We are actually not going to convert the examples manually, but are building a system to do it automatically. As such, there is no place to contribute for now. When we’re done everything will be converted all at once.

Thanks for the offer to contribute! There may be some examples that may need work in the future, at which point we’ll gladly take you up on that 😃.

1reaction
rix0rrrcommented, Sep 16, 2019

We are aware that all examples are in TypeScript and not in your language of choice (be it Python, Java or C#).

This is unfortunately the way things are today. We’d rather leave the examples in than take them out altogether, as the shape of the code should still be the same and you should be able to use a short set of translation rules to end up with code that would work in your language.

Rest assured that we are working on providing example code in multiple languages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with the AWS CDK in JavaScript
cdk init uses the name of the project folder to name various elements of the project, including classes, subfolders, and files. Hyphens in...
Read more >
A Beginner's Guide to Create AWS CDK Construct Library with ...
jsii allows you to generate libraries from TypeScript code to work in Python, Java, and .NET. Create project. Create a Construct Library project ......
Read more >
Examples and Guides - CDK for Terraform
Resources to help you learn CDK for Terraform, including example projects in Typescript, Java, Python, C#, and Go.
Read more >
AWS CDK Toolkit - npm
They are files that include everything needed to deploy your app to a cloud environment. For example, it includes an AWS CloudFormation template...
Read more >
How do I build lambdas in different languages using AWS ...
... which provide standard bundling for Python and Node.js, respectively. This AWS Blog post gives some more examples for bundling.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found