# How to do development on ubuntu ec2

**URL:** <https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105>\
**Category:** AWS Storage Discussion\
**Tags:** ec2, s3\
**Created:** [April 3, 2019, 7:53am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105 "2019-04-03T07:53:51Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![secretkappapride](https://awshq.com/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@secretkappapride](https://awshq.com/u/secretkappapride)\
**Post date:** [April 3, 2019, 7:53am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/1 "2019-04-03T07:53:51Z")

</div>

Hi, i recently started studying for aws developer associate certification, i am developing a small flask application for learning on an ubuntu ec2 instance, however I’m finding using the nano editor very cumbersome, i am thinking of writing the code on local machine then uploading to s3 then downloading code on ec2 from s3, is there any other way to do this efficiently and faster?  
Thanks for reading!

* * *

**Related discussions:**

- [Confused about what happens when the new free tier ends](https://awshq.com/t/confused-about-what-happens-when-the-new-free-tier-ends/21741)
- [Reliably identify which EC2/tenant is calling in Lambda](https://awshq.com/t/reliably-identify-which-ec2-tenant-is-calling-in-lambda/21687)
- [Need an optimized sandbox setup for coding agents](https://awshq.com/t/need-an-optimized-sandbox-setup-for-coding-agents/21770)
- [AWS warns of EC2 ‘impairment’ as power loss hits notorious US-EAST-1 region](https://awshq.com/t/aws-warns-of-ec2-impairment-as-power-loss-hits-notorious-us-east-1-region/21287)
- [We stopped putting team in our AWS cost allocation tags](https://awshq.com/t/we-stopped-putting-team-in-our-aws-cost-allocation-tags/21655)

---

<div class="post-metadata">

**Author:** ![002445](https://awshq.com/letter_avatar_proxy/v4/letter/0/5daacb/32.png) [@002445](https://awshq.com/u/002445)\
**Post date:** [April 3, 2019, 9:54am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/2 "2019-04-03T09:54:41Z")

</div>

Many roads to rome but what I do is develop on local machines, track all changes with Git and simply pull the git repository on a staging server first and then onto the production server if no bugs are found.

After most updates I delete the EC2 staging instance and create a new one from a recent snapshot if a new update is ready.

---

<div class="post-metadata">

**Author:** ![secretkappapride](https://awshq.com/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@secretkappapride](https://awshq.com/u/secretkappapride)\
**Post date:** [April 3, 2019, 10:26am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/3 "2019-04-03T10:26:33Z")

</div>

> [@002445](#):
>
> Many roads to rome but what I do is develop on local machines, track all changes with Git and simply pull the git repository on a staging server first and then onto the production server if no bugs are found. After most …

Thanks, I’ll try with Git!

---

<div class="post-metadata">

**Author:** ![bmullan](https://awshq.com/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@bmullan](https://awshq.com/u/bmullan)\
**Post date:** [April 3, 2019, 10:26am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/4 "2019-04-03T10:26:38Z")

</div>

You could also install a Desktop Environment  
and the x2go server side component on the ubuntu server both are just 1 or 2 apt commands

Then on your client side install the x2go client.. again just 2 cmds.

Start the x2go client, create a new session config w IP of the EC2 ubuntu, ID the DE you put on the EC2 instance.

The execute that “session” in the x2go client

Within a couple of seconds you will have a desktop from the server, be able to cut&paste, print, share files, have audio etc from the remote desktop to you locally.

[www.x2go.org](http://www.x2go.org)

Just remember on the EC2 ubuntu to configure /etc/ssh/sshd\_config for whether you are using login ID/Password or ssh keys etc to match what you configured into the x2go “session” config

All the above only takes a couple minutes.

---

<div class="post-metadata">

**Author:** ![figuringoutlyf](https://awshq.com/letter_avatar_proxy/v4/letter/f/59ef9b/32.png) [@figuringoutlyf](https://awshq.com/u/figuringoutlyf)\
**Post date:** [April 3, 2019, 10:30am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/5 "2019-04-03T10:30:20Z")

</div>

You can checkout AWS Codepipeline.  
Rough steps would be  
- You can use git to track your changes locally.

- use AWS CodeCommit as your remote git repo.

- Use AWS Codebuild to build your code

- Use AWS CodeDeploy to deploy your code to ec2 instance.

You will install code deploy agent on your EC2 instance. CodePipeline can be used to connect CodeCommit to Codebuilt, to CodeDeploy.

So whenever you make a commit, codePipeline gets to work. It copies over your code and builds using CodeBuild. The intermediate artifacts are stored in S3. Next, codeDeploy will pull these artifact and notify the codeDeploy Agent in your EC2 instance. Now codeDeploy agent can pull in your changes, and then run the installation script.

I feel this is a good setup, if you have some tests you can also add a stage to run your tests before deploying. This comes very much near to having a stable workflow.

You can use AWS console GUI to setup pipelines and stuff or use cloudformation scripts.

---

<div class="post-metadata">

**Author:** ![TTGG](https://awshq.com/letter_avatar_proxy/v4/letter/t/43a26b/32.png) [@TTGG](https://awshq.com/u/TTGG)\
**Post date:** [April 3, 2019, 10:53am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/6 "2019-04-03T10:53:23Z")

</div>

> [@secretkappapride](#):
>
> Thanks, I’ll try with Git!

You can use CodeCommit in AWS.

---

<div class="post-metadata">

**Author:** ![secretkappapride](https://awshq.com/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@secretkappapride](https://awshq.com/u/secretkappapride)\
**Post date:** [April 3, 2019, 11:25am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/7 "2019-04-03T11:25:05Z")

</div>

> [@TTGG](#):
>
> You can use CodeCommit in AWS.

Ia it free? 😅

---

<div class="post-metadata">

**Author:** ![TTGG](https://awshq.com/letter_avatar_proxy/v4/letter/t/43a26b/32.png) [@TTGG](https://awshq.com/u/TTGG)\
**Post date:** [April 3, 2019, 11:47am UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/8 "2019-04-03T11:47:38Z")

</div>

> [@secretkappapride](#):
>
> Ia it free? 😅

Yes, for small scale:  
[https://aws.amazon.com/codecommit/pricing/](https://aws.amazon.com/codecommit/pricing/)

---

<div class="post-metadata">

**Author:** ![Mozorelo](https://awshq.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Mozorelo](https://awshq.com/u/Mozorelo)\
**Post date:** [April 3, 2019, 1:19pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/9 "2019-04-03T13:19:12Z")

</div>

You can run vscode on your VM if you want

[https://youtu.be/N5WojMutddQ](https://youtu.be/N5WojMutddQ)

---

<div class="post-metadata">

**Author:** ![secretkappapride](https://awshq.com/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@secretkappapride](https://awshq.com/u/secretkappapride)\
**Post date:** [April 3, 2019, 1:23pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/10 "2019-04-03T13:23:22Z")

</div>

> [@Mozorelo](#):
>
> You can run vscode on your VM if you want
> 
> [https://youtu.be/N5WojMutddQ](https://youtu.be/N5WojMutddQ)

The ubuntu instance is a ubuntu server 18.04 it doesn’t have gui only cli

---

<div class="post-metadata">

**Author:** ![Mozorelo](https://awshq.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Mozorelo](https://awshq.com/u/Mozorelo)\
**Post date:** [April 3, 2019, 2:13pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/11 "2019-04-03T14:13:07Z")

</div>

> [@secretkappapride](#):
>
> The ubuntu instance is a ubuntu server 18.04 it doesn’t have gui only cli

In the video he only uses cli and deploys vscode to a browser window that you access on your local machine. Didn’t watch it did you?

---

<div class="post-metadata">

**Author:** ![secretkappapride](https://awshq.com/letter_avatar_proxy/v4/letter/s/9de0a6/32.png) [@secretkappapride](https://awshq.com/u/secretkappapride)\
**Post date:** [April 3, 2019, 2:15pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/12 "2019-04-03T14:15:53Z")

</div>

> [@Mozorelo](#):
>
> In the video he only uses cli and deploys vscode to a browser window that you access on your local machine. Didn’t watch it did you?

Ohk, yup didn’t watch, would see at home, was in office so couldn’t check it out​👀

---

<div class="post-metadata">

**Author:** ![lorarc](https://awshq.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@lorarc](https://awshq.com/u/lorarc)\
**Post date:** [April 3, 2019, 4:06pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/13 "2019-04-03T16:06:04Z")

</div>

> [@002445](#):
>
> Many roads to rome but what I do is develop on local machines, track all changes with Git and simply pull the git repository on a staging server first and then onto the production server if no bugs are found. After most …

Git is not a deploy tool. But yeah, most of the places I know do it exactly that way and that’s also what I would do.

---

<div class="post-metadata">

**Author:** ![1842](https://awshq.com/letter_avatar_proxy/v4/letter/1/ecccb3/32.png) [@1842](https://awshq.com/u/1842)\
**Post date:** [April 3, 2019, 5:02pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/14 "2019-04-03T17:02:45Z")

</div>

I typically develop on my local machine.

If I’m doing development on a remote machine (typically development-type environment), then there are a few options I’ll pick from for my use case. Each one allows me to use my IDE locally, but there are trade-offs.

- For projects that will take a while, I’ll set up PHPStorm/PyCharm to autodeploy via SFTP on file save (see the deployment section). This keeps the files on the server in-sync as I edit them locally. Takes a some time to configure.
- For larger projects that I need to do quick fixes on, I’ll typically use rsync on the command line to copy files up when I’m ready to test on dev. Something like `rsync -a folder/to/sync user@server:/path/to/remote\_folder`. It’s roughly the same syntax as scp, but it only copies changed files. Fast to set up, fast to copy, but you have to remember to copy changes up to test.
- For really small projects (\<20 files), sometimes I’ll use a SSH mount (sshfs). This makes the remote files appear as local ones. This is simple since there’s only one set of files, but if the project gets too large, your IDE (and git) will become incredibly slow.

For higher environments (UAT / staging / prod-like), then I’ll have something staged in git and pull code from there. If there’s a hotfix I need to test, I’ll just use vim on the server.

---

<div class="post-metadata">

**Author:** ![Mozorelo](https://awshq.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Mozorelo](https://awshq.com/u/Mozorelo)\
**Post date:** [April 3, 2019, 5:53pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/15 "2019-04-03T17:53:00Z")

</div>

> [@lorarc](#):
>
> Git is not a deploy tool. But yeah, most of the places I know do it exactly that way and that’s also what I would do.

What would you use a deploy tool?

---

<div class="post-metadata">

**Author:** ![lorarc](https://awshq.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@lorarc](https://awshq.com/u/lorarc)\
**Post date:** [April 3, 2019, 8:45pm UTC](https://awshq.com/t/how-to-do-development-on-ubuntu-ec2/8105/16 "2019-04-03T20:45:56Z")

</div>

> [@Mozorelo](#):
>
> What would you use a deploy tool?

Git of course. If we want something more advance than use AWS Code Deploy, it takes like 15 minutes to set the basic scenario and comes with loads and loads and loads of stuff out-of-the-box like automatic green-blue.
