Project to create URL Shortener using:
- AWS Chalice
- AWS Lambda
- AWS DynamoDB
- AWS Account
- AWS IAM Role with Access Keys and appropriate policies attached
- Python 2.7.x or 3.6.x
- Open the DynamoDB console
- Choose Create Table
- In the Create DynamoDB table screen, do the following:
- In the Table name field, type
url-shortener
- For the Primary key, in the Partition key field, type
token
. Set the data type to String.
- In the Table name field, type
- Click Create.
mkdir aws-chalice
cd aws-chalice
python3 -m venv chalice
source chalice/bin/activate
pip3 install chalice
pip3 install boto3
touch ~/.aws/config
echo "[default]" >> ~/.aws/config
echo "aws_access_key_id=AK123" >> ~/.aws/config
echo "aws_secret_access_key=abc123" >> ~/.aws/config
echo "region=us-east-1" >> ~/.aws/config
git clone https://github.com/skipluck/url-shortener-chalice
AWS Chalice allows you to spin up a local HTTP server that mimics AWS API gateway. This is helpful for testing applications prior to deploying to AWS.
chalice local
Open a new terminal window and use curl to test
curl -H "Content-Type: application/json" -X POST -d '{"url":"https://www.google.com"}' http://localhost:8000/
Even while running the application locally it will make entries in DynamoDB on AWS.
chalice deploy
chalice delete