Initial commit

This commit is contained in:
Domenico Testa
2020-04-14 12:18:24 +02:00
commit 17017a1f84
9 changed files with 154 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
*.swp
package-lock.json
__pycache__
.pytest_cache
.env
*.egg-info
# CDK asset staging directory
.cdk.staging
cdk.out

58
README.md Normal file
View File

@@ -0,0 +1,58 @@
# Welcome to your CDK Python project!
This is a blank project for Python development with CDK.
The `cdk.json` file tells the CDK Toolkit how to execute your app.
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the .env
directory. To create the virtualenv it assumes that there is a `python3`
(or `python` for Windows) executable in your path with access to the `venv`
package. If for any reason the automatic creation of the virtualenv fails,
you can create the virtualenv manually.
To manually create a virtualenv on MacOS and Linux:
```
$ python3 -m venv .env
```
After the init process completes and the virtualenv is created, you can use the following
step to activate your virtualenv.
```
$ source .env/bin/activate
```
If you are a Windows platform, you would activate the virtualenv like this:
```
% .env\Scripts\activate.bat
```
Once the virtualenv is activated, you can install the required dependencies.
```
$ pip install -r requirements.txt
```
At this point you can now synthesize the CloudFormation template for this code.
```
$ cdk synth
```
To add additional dependencies, for example other CDK libraries, just add
them to your `setup.py` file and rerun the `pip install -r requirements.txt`
command.
## Useful commands
* `cdk ls` list all stacks in the app
* `cdk synth` emits the synthesized CloudFormation template
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk docs` open CDK documentation
Enjoy!

11
app.py Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env python3
from aws_cdk import core
from karaokeme_cdk.karaokeme_cdk_stack import KaraokemeCdkStack
app = core.App()
KaraokemeCdkStack(app, "karaokeme-cdk")
app.synth()

7
cdk.json Normal file
View File

@@ -0,0 +1,7 @@
{
"app": "python3 app.py",
"context": {
"@aws-cdk/core:enableStackNameDuplicates": "true",
"aws-cdk:enableDiffNoFail": "true"
}
}

View File

View File

@@ -0,0 +1,9 @@
from aws_cdk import core
class KaraokemeCdkStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# The code that defines your stack goes here

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
-e .

45
setup.py Normal file
View File

@@ -0,0 +1,45 @@
import setuptools
with open("README.md") as fp:
long_description = fp.read()
setuptools.setup(
name="karaokeme_cdk",
version="0.0.1",
description="An empty CDK Python app",
long_description=long_description,
long_description_content_type="text/markdown",
author="author",
package_dir={"": "karaokeme_cdk"},
packages=setuptools.find_packages(where="karaokeme_cdk"),
install_requires=[
"aws-cdk.core==1.32.2",
],
python_requires=">=3.6",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: JavaScript",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Code Generators",
"Topic :: Utilities",
"Typing :: Typed",
],
)

13
source.bat Normal file
View File

@@ -0,0 +1,13 @@
@echo off
rem The sole purpose of this script is to make the command
rem
rem source .env/bin/activate
rem
rem (which activates a Python virtualenv on Linux or Mac OS X) work on Windows.
rem On Windows, this command just runs this batch file (the argument is ignored).
rem
rem Now we don't need to document a Windows command for activating a virtualenv.
echo Executing .env\Scripts\activate.bat for you
.env\Scripts\activate.bat