Develop with PyCharm on an AWS Instance
In this post, we will introduce another tool that makes development on AWS much easier and more efficient. When coding in Python, the PyCharm IDE is popular for its ease of use in writing and debugging code. In the previous post, we explored how to establish a graphical user interface on AWS and connect to it via RDP. This would allow us to install PyCharm on the AWS instance and use it like a local machine. In this post, however, we shall focus on a more efficient way to develop on AWS.
Sticking to PyCharm’s professional edition has allowed us to work on AWS (or any remote machine) with an experience nearly identical to working on our local machine. It does that by enabling the GUI to work locally while the code runs remotely. Here are the steps used to establish that remote connection.
Step 1: Access Remote Development
Navigate to the File menu and select Remote Development.
Step 2: Create a New SSH Connection
Under SSH Connections, select New Connection.
Step 3: Configure the SSH Connection
● Enter the username (ubuntu unless you created a new user).
● Provide the host address (the same one you use for your SSH connection).
● Specify the path to your private key.
Step 4: Select the Project Folder
Choose the project folder located on your AWS instance.
Step 5: Open the Remote PyCharm Window
After establishing the connection, a new PyCharm window will open with your project from the AWS instance. This setup allows you to work on AWS seamlessly, feeling as if you were using your local machine.
Using PyCharm for Remote Development: Notes from the Field
Debugging
When working remotely with PyCharm, the experience mimics that of working on a local machine, especially when debugging. Debugging tools, such as breakpoints, step-into functions, and modifying local variables during code execution, function seamlessly with PyCharm. One limitation for debugging remotely that users need to be aware of is the inability to use Matplotlib to display images.
2. Stable Connections
In scenarios where you have extensive training tasks running on AWS, which might take several days, PyCharm remote development proves to be able to keep a stable connection. The training process will continue even if your local machine loses internet connection, shuts down, or restarts. Upon reestablishing the connection and reconnecting through PyCharm remote development, you will find that the training has progressed uninterrupted as if nothing had happened.
3. Alternatives to PyCharm
It's also worth mentioning that VS Code, another highly popular IDE, offers remote development capabilities. The choice between PyCharm and VS Code largely depends on personal preference. One distinct difference between them is that VS Code is free to use, whereas PyCharm remote development requires a PyCharm Professional license.
This blog post helps demonstrate how PyCharm's remote development capabilities can enhance your development workflow on AWS. The next post, Part 5, the last in our series on developing deep learning on AWS, walks you through the intricacies of migrating an AWS instance from one region to another.
Part 3: Data Handling in AWS
コメント