How to Run a Python Script 24/7 for Free (Ubuntu Server on AWS)

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024

Комментарии • 197

  • @CameronCobb
    @CameronCobb  5 лет назад +13

    If anyone has any questions, video suggestions, or want to critique my videos please do here in the comment section.

    • @hoottubee6367
      @hoottubee6367 5 лет назад +2

      hey can i run instagrambot to ubuntu server with your video training ?

    • @michelegentile3563
      @michelegentile3563 5 лет назад

      how can i be sure that will be always free?

    • @mattmryczko3608
      @mattmryczko3608 5 лет назад +1

      @@michelegentile3563 you can signup free for 12 months

    • @vespasian1566
      @vespasian1566 5 лет назад

      I scanned the FileZilla installed because I was suspicious of the website and MalwareBytes found malware. How should I proceed?

    • @mattmryczko3608
      @mattmryczko3608 5 лет назад

      @@vespasian1566 false positive

  • @filippoantoniocapizzi9068
    @filippoantoniocapizzi9068 5 лет назад +59

    This is the simplest and clearest video on running a Python script on AWS that I have ever watched.
    Up and running in less than 10 minutes.
    Great job!

  • @josuenascimento8644
    @josuenascimento8644 2 года назад +6

    Alert: this is the only video on RUclips that actually teaches how to run ur script/code 24/7, thank u so much Cameron

  • @eljevidealmagro
    @eljevidealmagro 4 года назад +8

    Thats exactly what im looking for. It took me 3 hours of lambdas study to discover thats not what im looking for... and here it is. I think this morning was a very educational one. Greetings, i subscribed

  • @AfsalK
    @AfsalK 2 года назад +2

    I don't think i can express my gratitude in words..😭😭😭you have no clue of how desperate i was

  • @babythedude
    @babythedude 5 лет назад +8

    yeah I got my python bot on aws following this video!! super neat!! thanks a ton

  • @EpochIsEpic
    @EpochIsEpic 3 года назад +5

    If anyone is wondering why sudo-apt isn't working it is because AWS's versions of linux replaced that command with "yum" command - so sudo apt-get update would actually be: sudo yum update

    • @EswarKumar1
      @EswarKumar1 3 года назад

      I used up 85% of my free tier-AWS usage and now if I create this server for my QR Code scanner project, how long it will take to use my complete AWS usage of free tier?

    • @EpochIsEpic
      @EpochIsEpic 3 года назад +1

      @@EswarKumar1 No clue m8

  • @rickyS-D76
    @rickyS-D76 4 года назад +2

    I was looking for the solution like these for some time and now i have found it. Thanks for Sharing.

  • @alexanderlee1168
    @alexanderlee1168 3 года назад +1

    Perfect video. Very helpful for a first time AWS user and you made the process very intuitive and easy. Thank you very much.

  • @LorenzoValente
    @LorenzoValente 4 года назад +2

    Best tutorial I've ever seen, thank you Cameron!

  • @oscwavcommentaccount
    @oscwavcommentaccount 4 года назад +10

    I didn't know AWS had a free plan.

  • @mukeshwarsingh270
    @mukeshwarsingh270 3 года назад

    OMG! This actually works! I tried it on my VPS! Thanks Buddy :)

  • @yassinenacif418
    @yassinenacif418 4 года назад +1

    Truly wonderful Job!! Clear & Useful!!

  • @grigoriipodoksik9296
    @grigoriipodoksik9296 2 года назад

    This is the best tutorial on this topic. Quick, simple and understandable. Thank you very much!!

  • @WysockiD
    @WysockiD 3 года назад +2

    Honestly cant thank you enough for this video

  • @TheDrGaby
    @TheDrGaby 5 лет назад +9

    Hey, great video I try to set up Instapy with this. Can you explain the condition for it to be free ? I've seen it's up to 750 hours of "micro-management" per months. What does it means ?

  • @johnstrobel6712
    @johnstrobel6712 4 года назад +1

    Great video, the whole process works great!

  • @kirand3664
    @kirand3664 5 лет назад +1

    Nice Video Cam..thanks for the sharing..sharing is caring.

  • @Kemal-vw8xb
    @Kemal-vw8xb 3 года назад +1

    I am getting "No supported authentication methods available(server sent: publickey, gssapi-keyex,gssapi-with-mi) error. What do you think about this error? Thanks.

  • @manuelpaz7619
    @manuelpaz7619 5 лет назад +2

    Great Man, Thank you very much from Spain!!

  • @johnstrobel6712
    @johnstrobel6712 4 года назад +2

    Ctrl+ a ctrl+d wasn't working for me, so I just did ctrl+z bg to background it. That seemed to work when I exited the putty client, but now I can't seem to access the backgrounded process, anyone have some advice?
    Edit: backgrounding the process didn't actually work as expected. If anyone has a different workaround for ctrl+a ctrl+d I would appreciate it!
    Edit 2: Fixed it with a sudo apt-get upgrade screen :)

  • @yesman6920
    @yesman6920 4 года назад +1

    beautiful video, Thanks a lot. Helped me in a great way

  • @arthbhalodiya
    @arthbhalodiya 4 года назад +1

    Thank you so much man 🙏 Love from India

  • @omarcruz6326
    @omarcruz6326 3 года назад

    Nice. !!!
    Great video, Cameron.

  • @MrJvdAli
    @MrJvdAli 5 лет назад +3

    awesome tutorial thank you :)

  • @bitcointrader8586
    @bitcointrader8586 4 года назад +1

    What a helpful video, nice job dude

  • @washburnlane
    @washburnlane 4 года назад +1

    So good, I subscribed!

  • @theresaschmaus9186
    @theresaschmaus9186 5 лет назад +4

    Hi Cameron, this video is really great! I finally got my python code running on EC2, thanks!
    I have a follow-up question: sometimes my code breaks due to a connection error with the Twitter API. Do you have an idea how I can modify the screen to make it reboot and restart the program when an error occurs?

    • @CameronCobb
      @CameronCobb  5 лет назад +1

      Theresa Schmaus I would put try and except statements in your code to prevent your program crashing instead. I’m not sure of what your experience level is but look up try and except statements in Python. Your program should not crash.

    • @theresaschmaus9186
      @theresaschmaus9186 5 лет назад +1

      @@CameronCobb Thanks for the advice! I think I found some useful try and except statements.

  • @thecodebear
    @thecodebear 4 года назад

    Great tutorial man 👍

  • @jordanparkinson842
    @jordanparkinson842 Год назад

    Yes!! This is perfect for first time user! Thanks ❤

  • @tonispamony
    @tonispamony 5 лет назад +2

    how would i connect to a mobile platform and launch functions from this ec2 type set up from clicking a button in an app. im kinda looking for the code to be able to connect a server response with a button function in swift

    • @CameronCobb
      @CameronCobb  5 лет назад

      Ummm, not quite exactly sure... sorry. I recommend you ask that question on StackOverflow

    • @tonispamony
      @tonispamony 5 лет назад

      @@CameronCobb iv been looking around, im not too versed though in the subject. is there another method in which you would think would work? at this point im thinking of making my own pod to try and use python in a swift app

  • @Vostro123
    @Vostro123 4 года назад +1

    Awesome! Thank you very much

  • @mdaasil2329
    @mdaasil2329 2 года назад

    Thanks a lot bro. Wonderful tutorial!

  • @adityavaste3732
    @adityavaste3732 2 года назад

    wow, perfect video for me.....
    Appreciate you...👏👏

  • @spectrumdb
    @spectrumdb 3 года назад

    Many thanks. Simple and working tutorial :)

  • @gabkov
    @gabkov 4 года назад

    awesome video dude !!

  • @HugoGonzalez-ec7pm
    @HugoGonzalez-ec7pm 3 года назад

    Great video, it works great for me. Thank you

  • @abdouldhulas9475
    @abdouldhulas9475 4 года назад +1

    Thanks that helps me a lot

  • @slowlee25
    @slowlee25 4 года назад

    Very well done video very helpful. Also great voice you should become a youtuber hehe.

  • @ChrisSavichi
    @ChrisSavichi 5 лет назад +1

    Great video, thank you

  • @arindamroy7671
    @arindamroy7671 2 года назад

    Great work. Could you please elaborate on the screen utility?

  • @behrouzbeheshti
    @behrouzbeheshti 5 лет назад +2

    Thanks for the awesome video. May I ask how I can access the files the my Python creates in the instance; I can't see them on FileZilla, is there way to 'pull' them?

    • @behrouzbeheshti
      @behrouzbeheshti 5 лет назад +1

      I reply myself here as instantly; I got the files from FileZilla after refreshing the folder on it.

  • @renatonuneslima7995
    @renatonuneslima7995 4 года назад

    Nice video! I would like to know if there is anything we should pay attention if your code, for example, needed to access a database in another cloud service. Thank you!

  • @minhaj6211
    @minhaj6211 3 года назад

    Thank you very much. Thumbs up, sir.

  • @danielfisher2088
    @danielfisher2088 2 года назад

    Hey, super helpful video, the setup worked great, thanks!
    It has been a few months now and I started getting this error where my ec2 instance wont load and I get the message "Network Error: Connection timed out." I've googled around a bunch and tried several of the troubleshooting steps I found but unfortunately I haven't been able to figure it out. I was wondering if you've encountered this before and might have some advice as to how to resolve it? Thanks for your time!

  • @snakefingersgaming5336
    @snakefingersgaming5336 2 года назад

    thankyou so much for this :)

  • @sylvainbeaucheminspersonal372
    @sylvainbeaucheminspersonal372 2 года назад

    Nice, crazy easy!

  • @HiPh0Plover1
    @HiPh0Plover1 4 года назад +1

    great video and channel , what do you use your telegram bot for ?

    • @CameronCobb
      @CameronCobb  3 года назад

      I use to run python engagement groups/pods but I don't do that anymore

  • @lionex3767
    @lionex3767 3 года назад +1

    bro please help! in filezilla my key file doesn't even upload , i even tried putting the address manually but dowsn.t wok

    • @aaronjauregui170
      @aaronjauregui170 3 года назад

      Yeah same i cant get passed it. Did you end up figuring it out?

  • @hibald8351
    @hibald8351 3 года назад

    Hi Thanks for you tut.....but what to use instead of
    PuTTY for windows users?

  • @FallingThings
    @FallingThings 5 лет назад +2

    Same procedure with instapy?

  • @2Muneeb
    @2Muneeb 3 года назад

    Thanks man

  • @adityar6511
    @adityar6511 2 года назад

    What is the differance between nohup and screen commands
    And would they be still running if you close the laptop/pc?

  • @yangliu9127
    @yangliu9127 Год назад

    Alert: EC2 server's free tier service now has a trial period. The free quota is only available for 12 months, then the service will be charged no matter how much resource you use.

  • @HackYourIphoneYarinCohen
    @HackYourIphoneYarinCohen 5 лет назад

    so after you get the server set up and started do you need the pc to stay on? or you can shut it down and the script will keep running?

    • @CameronCobb
      @CameronCobb  5 лет назад

      You need the server to stay on for the script to run continuously. There is no reason to shut down the AWS server because it is suppose to be running 24/7

  • @Revan1
    @Revan1 3 года назад +1

    can someone please help
    how do you remove it from screen
    my bot sends its messages 3 times instead of once

    • @CameronCobb
      @CameronCobb  3 года назад

      You have 3 instances of screen running. You will want to kill those other instances

    • @Revan1
      @Revan1 3 года назад

      @@CameronCobb what would i type to kill it?

  • @Nathanielleich
    @Nathanielleich 4 года назад +1

    Hi there, thank you for this very informative video. I am attempting to run a python script 24/7 off of OS, not windows. I managed to install Putty for windows, but haven't been able to access PuttyGen. If you know of any way I can do this, it would be much appreciated. Thanks, Nat.

  • @adityamulik
    @adityamulik 5 лет назад

    How reliable is the screen unix function? I just used the function to run a py script which runs without any error. I had to do that cause crontab wasn’t helpful. Is screen recommended for production use?

  • @friendlycreeper1045
    @friendlycreeper1045 Год назад

    How to detach and attach multiple terminals?

  • @jvjplus
    @jvjplus 3 года назад +1

    do we have to run python program in while loop to keep it runnning?

  • @minenandha
    @minenandha 3 года назад +1

    They won't charge any money untill we exceed free tier eligible limits, ryt?

    • @CameronCobb
      @CameronCobb  3 года назад

      I think so. It’s been awhile since I have last checked

  • @FRUXT
    @FRUXT Год назад

    How do you make your script running constantly ? You use a while loop ?

  • @danieltrump9110
    @danieltrump9110 4 года назад +1

    How can I re-run the normal python script? I just want to run it at 9 am once and not all the time.

    • @CameronCobb
      @CameronCobb  3 года назад +1

      You may want to look into cron jobs instead

  • @anzelnel9586
    @anzelnel9586 2 года назад

    Watching this video for a second time and when I attempt screen -r I get the error "There are several suitable screens on. Type "screen [-d] -r [pid.]tty.host" to resume one of them." Please advise

  • @moritzweinhandler8085
    @moritzweinhandler8085 5 лет назад

    Hey Cameron, that's a real good video. But I have a question on the running python script. I want to launch a python program, which is processing data sent by json api. My script should work with this input data and access data in excel. Is it possible to use this server for this purpose? And if it is, what url has my server in order to send the data in the first place?

    • @CameronCobb
      @CameronCobb  5 лет назад

      If it works on your computer using just the command line and not using any browser support like Selenium then I assume it would work.

  • @samirfarooq4630
    @samirfarooq4630 4 года назад

    In my socket_server.py file, what IP address do I bind to? Then, what IP address do I connect to in my socket_client.py file?

  • @rupeshypr1436
    @rupeshypr1436 3 года назад

    What software need to install if I go through this process, terminal is enough or do I need to install putty?help me out this?

  • @itayhamamy8885
    @itayhamamy8885 Год назад

    I understand this method works if you interact this some input but will this method work if I use python-crontab to set specific time to run the code?
    I plan to run python script every day at specific time without need for me to interact with it like you did in the video (you interacted with the program through telegram)

  • @giacomocarfi5015
    @giacomocarfi5015 4 года назад

    do I need to use webhook or can I just use bot.polling()?

  • @Jinx000
    @Jinx000 3 года назад

    say you want a script to run bout you want to allow connections how would i do that?

  • @russsully3192
    @russsully3192 2 года назад

    I have two questions:
    Will it run c++?
    Are all of these programs Mac compatible? I know I’m gross but it’s all I have rn.
    Thanks

  • @pengjiaxu2893
    @pengjiaxu2893 4 года назад

    Do you have experience of pricing about dragging file using FileZilla? It says "AWS Free Tier includes 50GB data transfer out, 2,000,000 HTTP and HTTPS Requests with Amazon CloudFront." but I am not quit clear about this statement.... Thank you for any information about this.

  • @BeingBittu
    @BeingBittu 4 года назад

    I have a python script with a json file.. Can I add that file to the server?
    And one more thing issue I have faced that whenever I opened my AWS.. It showing to create an account and add credit or debit cards to continue as they will charge for using aws... So how can I get the AWS free and get that console window???
    Please help!!!......

  • @Kruiger1993
    @Kruiger1993 4 года назад

    For Mac users would you recommend to use putty as well it is it possible from the terminal it self?

    • @CameronCobb
      @CameronCobb  3 года назад

      I would recommend the terminal itself for Mac.

  • @masterg6477
    @masterg6477 4 года назад +1

    if i have mysql how i can do that?

    • @CameronCobb
      @CameronCobb  3 года назад

      You would most likely have to install MySql on the server. There are some things I do not know what you are trying to do

  • @xRapids17
    @xRapids17 4 года назад

    It says your instance configuration is no eligible for free usage tier?? Help

    • @CameronCobb
      @CameronCobb  4 года назад

      xRapids17 maybe pick a different instance or pick a different configuration?

  • @alpacino584
    @alpacino584 4 года назад

    Hello, first of great video. I have a similar problem, but I need to use my python script on request. So I need a webserver where I can make a request to and execute my python script with a given POST Parameter. How would you do that?

  • @paulowe6291
    @paulowe6291 4 года назад +1

    Hi great video, Is there a way I can interface my python web scraping scripts on my personal website?

    • @CameronCobb
      @CameronCobb  4 года назад +1

      Paul Owe that’s a more complicated problem. If I may ask, is your website a WordPress website? Is it a custom built website with a Node.js or Python based server? Please give me more details and I can point you in the right direction

    • @paulowe6291
      @paulowe6291 4 года назад

      @@CameronCobb My website is a simple bootstrap template I got and I am hosting it on Bluehost. I am using it as a portfolio and I would love it if I could allow users to run the web scraping scripts I wrote. Also some other scripts are needed to connect to twitter's API to handle the authentication, so I don't know if this Is even possible to do or not.

  • @vladlemos
    @vladlemos 4 года назад

    Thank you so much!
    Do you know if is somehow possible to code directly at remote server with visual studio code?

    • @CameronCobb
      @CameronCobb  3 года назад

      You would have to get a Windows Server with a GUI. I don't ever recommend that though. I always code on my local computer and push to github then pull on my server or write a script that automatically deploys and runs my code.

  • @OnlineGreg
    @OnlineGreg 4 года назад +1

    hey, is this safe enough to run a crypto trading bot on the server?

    • @CameronCobb
      @CameronCobb  3 года назад

      As long as your server is secure and you can only access is via SSH along with other security measures

  • @photosotos8728
    @photosotos8728 2 года назад

    Is it run python script after shutdown my computer continuosly

  • @ericflynn5799
    @ericflynn5799 3 года назад

    How can this process be modified to be done via mac?

  • @GhenGhost
    @GhenGhost 4 года назад

    hi cameron, very useful tutorial. i have multiple python scripts running, but i want to stop running only 1 of them to edit the python script. how can i do this through putty?

    • @CameronCobb
      @CameronCobb  4 года назад

      GhenGhost you would have to stop running that one script and use VIM to edit the script and restart the script. Or you can edit the script on your local machine then transfer the new script over to your server via FileZilla and restart your script again via Putty. VIM can be confusing to new people so I would recommend the 2nd option

  • @toriwalker6566
    @toriwalker6566 2 года назад

    Does this work for google chromebook ?

  • @abetterliferu
    @abetterliferu 3 года назад

    How to run multiple scripts in screen?

  • @90kapo
    @90kapo 4 года назад

    thank you thank you

  • @EswarKumar1
    @EswarKumar1 3 года назад

    I used up 85% of my free tier-AWS usage and now if I create this server for my QR Code scanner project, how long it will take to use my complete AWS usage of free tier?

    • @CameronCobb
      @CameronCobb  3 года назад +1

      That really depends on the usage of the server. I don’t know what your QR code scanner project is but if it is doing a lot operations that requires a lot of CPU power, it can use up you AWS usage faster than simple project

    • @EswarKumar1
      @EswarKumar1 3 года назад

      @@CameronCobb Ok, I'll explain simply. It's my BTech project that uses Raspberry Pi and scans QR code whenever there is a motion detection. I want to upload it to the Cloud so only authenticated ppl can enter home.

  • @tohchengchuan6840
    @tohchengchuan6840 4 года назад

    hi sir, i would like to ask what if there is excel file that i need to read in python, and inside the python script, i had put the path to read the file, the path is something like this "C:\Users\pc\testing\abc.xlsx", do i need to rename the path? if yes, how should i do?

    • @manjunathrs7957
      @manjunathrs7957 4 года назад

      Just mention the file name only in the path. Make sure python script and excel file are in same directory.

    • @tohchengchuan6840
      @tohchengchuan6840 4 года назад

      @@manjunathrs7957 ok thanks for your reply, sir

  • @samirmishra9946
    @samirmishra9946 3 года назад

    You didnt need anything to run the file constantly for 24 7? I thought you need some external service or software to keep it running. In my case i want to run a discord bot so itd shut down when youd close the ubuntu window. I guess ctrl a+d might do the trick.

  • @ahtisham996
    @ahtisham996 2 года назад

    hey i need your help i am unable to install python binance Library on Ubuntu aws server i had done the same steps as u did but it's showing erorr while installing python binance need help ! 😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓😓

  • @ayushsahu6861
    @ayushsahu6861 4 года назад +1

    Will it work with file handling also?

    • @CameronCobb
      @CameronCobb  3 года назад

      Yes. It should work like a regular computer.

  • @wenocode
    @wenocode 5 лет назад +1

    I just have a question: how to leave the terminal and leave the process turned on using CTRL+ ALT + D, if I will respond in return this -> ^[

    • @CameronCobb
      @CameronCobb  5 лет назад

      Why are you pressing CTRL+ ALT + D?

    • @wenocode
      @wenocode 5 лет назад

      @@CameronCobb It's a good question =)

  • @treecoffin9021
    @treecoffin9021 4 года назад

    Hey man, I'm trying to use your method here to put my discord bot on a server. Upon attempting to start the server in the ubuntu terminal though, I get ModuleNotFoundError: No module named 'discord' . How would I go about putting these necessary packages onto my server so I can host my bot?

    • @CameronCobb
      @CameronCobb  4 года назад

      Tree Coffin if it is a Python package that needs to be installed should you should be able to run pip3 install . That should fix it... I did a pip install with how to get Python packages in my video

    • @treecoffin9021
      @treecoffin9021 4 года назад

      @@CameronCobb Yeah this was easily fixed with a quick pip3 install discord.py
      Thanks!

  • @tomigoya
    @tomigoya 10 месяцев назад

    tkm

  • @anupaman7453
    @anupaman7453 2 года назад

    From where we can download the python telegram bot ... can you share the link

    • @CameronCobb
      @CameronCobb  2 года назад

      Not possible. The bot is not live anymore

  • @vladislavlevitin
    @vladislavlevitin 5 лет назад

    Hi might sound like a stupid question but does the server run when you shut down your PC?

    • @CameronCobb
      @CameronCobb  5 лет назад +1

      Vlad Levitin yes the server will still run if you shut down your PC. It will not run if you shut down the server. The server is meant to be running 24/7

    • @vladislavlevitin
      @vladislavlevitin 5 лет назад

      ​@@CameronCobb Thank you! After trying different things I got a better understanding of how the setup works. Great tutorial btw!

  • @arafatalahe
    @arafatalahe Месяц назад

    Can i add multiple screen?

  • @devmotlani1179
    @devmotlani1179 2 года назад

    how can i get access to telegram bot

  • @jxeyu
    @jxeyu 5 лет назад

    I get memory error when trying to run my script. Quick response would be great

  • @bobbledog10
    @bobbledog10 4 года назад

    hi I am also deploying a telegram bot. What if i need to make changes to the python script? Do I need to re-transfer the updated script to the server again?

    • @CameronCobb
      @CameronCobb  4 года назад

      bobbledog10 you could make changes right inside of the terminal but it is a pain. I would recommend making the change on your computer first then transfer the new file over. Another option is to push all changes to Git then do a git pull on your terminal