This repo contains the source code for my first app that uses AWS's Python Serverless Microframework, chalice. The app is live at https://konekti.us/aws-cf-validator/.
chalice does not have a defined mechanism for distributing code. I've listed the steps you can follow to launch the app.
- Install python 3.6 on your machine. My OS is Ubuntu 16.04. I used the J Fernyhough’s Personal Package Archive (PPA) as described in this blog post.
- Create an AWS credentials file. Refer to the boto3 docs for instructions.
- Use pip, pipenv or other python packaging tool to install the chalice and boto3 modules (e.g.,
pip install chalice boto3
). I recommend using pipenv because it cleanly handles python versions and environments. - Execute the commands in the text below.
chalice new-project my-chalice-project
cd my-chalice-project
rm app.py
wget https://raw.githubusercontent.com/konekti/aws-cf-validator/master/app.py
chalice deploy
- Note the REST API URL that
chalice deploy
prints. Add the string "validate" to the end. The URL for testing should resemblehttps://3d7dikellka.execute-api.us-east-1.amazonaws.com/api/validate/
. I set the environment variable CFURL to prevent repetitive typing. - Download a valid CloudFormation YAML template such as this one.
- Send a POST request using the data from the template. `curl -H "Content-Type: text/plain" --data-binary @vpc.yaml $CFURL. The response should be "{"validity": "true", "message": "valid"}".
In the case you get stuck, read the chalice README.