Aviv CDK Python library
Project description
AVIV CDK for Python
A set of AWS CDK examples and constructs.
Install
Requires:
- Python >= 3.6
- pip
pip install aviv-cdk
Extras (provides additionnal libraries, in order to build some constructs):
cicd
- CDK codebuild/deploynextstep
- Stepfunctions & codata
- data related stuff
pip install aviv-cdk[EXTRA]
Build, distrib & release
Requires twine to be installed (pip install twine
) and credentials to upload a new verison to pypi.
python3 setup.py sdist bdist_wheel
# test distrib
python3 -m twine upload --repository testpypi dist/*
Included CDK apps / samples
CICD
cdk -a 'python3 cicd.py' synth
IAM Idp
A construct that includes an AWS lambda function and a cfn_resources layer to support it.
This lambda is used to validate the IAM idp SAML provider.
Use the sample stack to get started!
# 1. Build the cfn_resources layer
cfnreqpath=$(python3 -c 'import sys; print(sys.prefix)')/share/aviv-cdk/cfn-resources/
pip install ${PIP_FLAGS} -r ${cfnreqpath}requirements.txt -t build/cfn_resources/
(cd build/cfn_resources/ && zip -q -r ../artifacts-cfn_resources.zip .)
# 2. Generate idp stack (example)
cdk -a 'python3 app_idp.py' synth
Resulting the stack and artifacts generated in cdk.out/
.
Or use the more automated way with AWS codebuild (locally) and the buildspec-iam-idp.
codebuild_build.sh -i aws/codebuild/standard:4.0 -a build -b buildspec-iam-idp.yml
Resulting in 2 zip files, artifacts.zip
with the whole cdk.out/ app and artifacts-cfn_resources.zip
which contains the python packages for the cfn_resources AWS lambda layer.
Command line tools
- aviv-aws (WIP)
Helper to run AWS stuff locally (CDK / SAM / StepFunctionsLocal) - aviv-cdk-sfn-extract
Extract a StateMachine from a CFN template
Develop and contribute :)
Requirements:
- Pipenv
- AWS cdk client
- [optional] docker
- [optional] AWS codebuild docker image (standard >= 4.0)
git clone https://github.com/aviv-group/aviv-cdk-python && cd aviv-cdk-python
pipenv install -d -e .
Use it
# Build layer for release
pip install -r lambdas/cfn_resources/requirements.txt -t build/layers/cfn_resources/
(cd build/layers/cfn_resources/ && zip -q -r ../../artifacts-cfn_resources.zip .)
# Or with codebuild agent - see: buildspec.yml
codebuild_build.sh -i aws/codebuild/standard:4.0 -a build
Test
Requires: pytest
pipenv run pytest -v tests/
Contribute
Yes please! Fork this project, tweak it and share it back by sending your PRs.
Have a look at the TODO's and changelog file if you're looking for inspiration.
License
This project is developed under the MIT license.
Author(s) and Contributors
- Jules Clement <jules.clement@aviv-group.com>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.