Pelican Deployment to S3 using AWS-CLI
Posted on Sat 14 May 2016 in Development
This blog is built using Pelican an amazing static site generator written in Python. I host this blog site on AWS S3 which makes it quite cheap to host a static site. Pelican also makes it easy to push to AWS S3 with the help of s3cmd. However, s3cmd doesn't support Python 3.x.
Here was the problem, I had Pelican running on Python 3.5 and s3cmd doesn't support Python 3.x. I could have fallen back to python 2.x to solve the problem but there was AWS CLI which supports Python 3.5 to the rescue.
All it requires is to install AWS CLI and make sure aws access keys are made available to it, for more information please check out AWS CLI documentation.
pip install awscli
Next, edit Makefile to change s3_upload task to use AWS CLI. Around line 114 in Makefile comment out line 115 under 's3_upload: publish' and add the following line
aws s3 sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl public-read --delete
Thats it!. Now you can keep Pelican with Python 3.x and still upload to s3 using AWS CLI. Run the below Make task to upload to s3.
make s3_upload