How to put python script in AWS? - python-3.x

I want to place my python machine learning code in AWS. Can someone please help me with the procedure. Thank you.
Python script is in .py format.

You have many options available:
You can start your script using EC2's User Data feature
You can use rsync your script to the EC2 instance and run it over SSH
You can build a Docker container in which you would include your script and run a task in ECS
If your script takes less than 15 minutes to execute, you can run it in a Lambda function

Related

Infinite loading in Jenkins when slaves are upgraded to Python 3

Our team has upgraded our slaves (Windows) from Python 2 to 3. When we try to run our Jenkins jobs, automated test cases were run successfully but we were stuck in xUnitIgnoredTests.py when this part is executing. Infinite loading is encountered when running the job.
enter image description here
We have upgraded our python file with Python 3 syntax. Is there any setup that might be missing?
Thanks.
RDP/connect to an agent and run the command directly. You might be able to get better console output that way.
If you still have Python2 on them run the script with that interpreter too to ensure that something else hasn't changed on the agent that is affecting the script.

Jenkins Converts linux bash script when deploying to AWS Codedploy

I am using Jenkins to build a project from Bitbucket and as a post build option I am deploying to an AWS EC2 instance using the CodeDeploy plugin. I have a bash script in my workspace on Jenkins that is a unix bash script meaning the line endings are /n obviously. The problem is when I go to run the bash script on the AWS instance after is it is deployed I am unable to run it because it somehow was converted to windows endline chars (/r/n). It is not option to just convert manually on the AWS instance as I am trying to automate a testing environment. I am not sure how this is possible. Does anyone have any ideas on how or why this maybe happening or how to fix it? Thank you in advance.

startup scripts for amazon linux ami

I'm trying to start a script every time I start my amazon micro instance (amazon linux ami).
I tried to put it in /etc/init.d/ and linkted it to /etc/rc.d/ but the script is not executed.
I've also looked at user-data scripts, but as I understand the documentation they are only executed on the first startup of the instance.
What do I have to do to run my script on every startup?
Init.d/rc.d are primarly used for services. Any scripts that you install here have to be enabled to run at boot chkconfig service on.
Since it sounds like you are really just running a one time script. You can set it up to run with cron using the #reboot flag instead of providing a time.

How to execute Shell Script ,while booting up EC2 Machine?

I want to execute shell script whenever I start my ec2 (Linux )instance first time
Any Suggestion Please.
For the time being you can add the entries/command in initrd file and you can create a softlink for it. This will help you to execute the shell script whenever u will start your linux machine whether it is on EC2 or on linux.
See "Running Commands on Your Linux Instance at Launch".
You can use "user data" or "cloud-init" to do it. There's a section when manually launching EC2 instances to add the user data, and you can do it through APIs too.

Can Jenkins run shell script on agent-less linux host

I am looking for a Jenkins plugin that makes it execute simple shell script into a given machine.
A possible execution of this plugin would be:
Given hostname,username,password, execution folder, and script --> connect to the machine and execute the script.
Can I do it without pre-configuring the machine as Jenkins slave?
I've checked out ssh-plugin and publish-over-ssh but they don't offer doing such thing without preconfiguring the hosts.
So I couldn't find the right built-in solution for Jenkins but Python Fabric is an interesting direction

Resources