HomeContact
Computerz
Quickly deploy a AWS EC2 instance with python and Ubuntu 18.04
René Dohmen
May 25, 2019
1 min

Working with the Ubuntu 18.04 default image as of 2019 it’s very easy to spin up an instance and deploy/manage stuff on it with Ansible.

I will list some common snippets I use, to quickly have a running EC2 instance with python3, virtualenv, flask and more.

Ansible setup

Contents of .hosts file:

Contents of deploy.yml file:

As noted, the python2, mv and vim stuff it optional, this is just my personal preference on any given linux host.

Amazon setup

Now start an EC2 instance and use the .pem file to get access. Copy your own id_rsa.pub to the ubuntu user at the EC2 instance, so you can login without a password and you are ready to use Ansible, including the possibility to become root when needed.

Add the IP or host name to your .hosts file and run.

Running the playbook

Create a virtualenv and:

Troubleshooting

Test connection with the host. If needed, configure the ssh agent.

Rerun the playbook with verbosity.

More to come in other posts.


Related Posts

Working with git submodules
October 15, 2023
3 min
© 2024, All Rights Reserved.
Powered by formatics

Quick Links

Advertise with usAbout UsContact Us

Social Media