0

I have an android app that must execute python code in ec2 on demand. What is the best way to implement this?

2
  • Does the Android app need to wait for a response from the Python script? Commented Feb 9, 2017 at 18:33
  • No, Python script will make run few Mysql queries.. thats all. Commented Feb 11, 2017 at 16:19

2 Answers 2

1

Have a look at the remote management tool that amazon provides.

You can have you servers setup with the tools,the ssm agent and the script you need to execute. Then send a remote command to them through the sdk.

Check the related ssm java sdk and how you can utilize it with android.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks !! I will try and revert back if i find any problems :)
0

Step to get started with Python as backend and Android:

  1. Install MAMP, WAMP or LAMP etc on your local computer depending on OS. Install python separately if it's not already included.
  2. Introduction to Flask and RESTful services : follow https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask.
  3. Maintain your code in version control eg Git. It is also useful to streamline your code upload from local to server.
  4. Get a server : Since you might have to install some modules/packages on your server I recommend to have server with root access. You can try AWS free tier for 12 months.
  5. Install Apache/Ngnix, python, SQL, phpmyadmin and Git depending on OS you have bought from AWS to start serving.
  6. Go to your server root (mostly /var/www/html/) and git clone your project repository and change your environment variables and configuration as per step 5.
  7. Ideally you should check here that you are getting expected response for your requests . Use Postman to test post requests.
  8. Now you can consume your web service on android using any networking library like retrofit or volley.

Let me know if you need clarity on any point. Happy coding.

3 Comments

I will try and get back to you if I run into any problems. Thanks :D
Hey Nitesh, you mentioned to use flask microframework if it a small application. The python application that I am trying to use does image processing. Is that considered small? Can I use it for this application? Also, can you slightly elaborate how to use the things that you mentioned because I am a newbie. Thanks :D
Edited my answer. Application size is decided by the scale and features it has. If its only doing image processing it can be considered as small application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.