Refactor create_ami.py