I have an android app that must execute python code in ec2 on demand. What is the best way to implement this?
Asked
Modified
8 years, 9 months ago
Viewed
506 times
Part
of Mobile Development and AWS Collectives
2
-
Does the Android app need to wait for a response from the Python script?Mark B– Mark B2017-02-09 18:33:53 +00:00Commented Feb 9, 2017 at 18:33
-
No, Python script will make run few Mysql queries.. thats all.Sukeerth Cheruvu– Sukeerth Cheruvu2017-02-11 16:19:55 +00:00Commented Feb 11, 2017 at 16:19
Add a comment
|
2 Answers
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.
1 Comment
Sukeerth Cheruvu
Thanks !! I will try and revert back if i find any problems :)
Step to get started with Python as backend and Android:
- Install MAMP, WAMP or LAMP etc on your local computer depending on OS. Install
pythonseparately if it's not already included. - Introduction to Flask and RESTful services : follow https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask.
- Maintain your code in version control eg
Git. It is also useful to streamline your code upload from local to server. - Get a server : Since you might have to install some modules/packages on your server I recommend to have server with
rootaccess. You can tryAWS free tierfor 12 months. - Install
Apache/Ngnix,python,SQL,phpmyadminandGitdepending on OS you have bought fromAWSto start serving. - Go to your server root (mostly
/var/www/html/) andgit cloneyour project repository and change your environment variables and configuration as per step 5. - Ideally you should check here that you are getting expected response for your requests . Use
Postmanto testpostrequests. - Now you can consume your web service on
androidusing any networking library like retrofit or volley.
Let me know if you need clarity on any point. Happy coding.
3 Comments
Sukeerth Cheruvu
I will try and get back to you if I run into any problems. Thanks :D
Sukeerth Cheruvu
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
Nitesh Verma
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.