| 1 |
.. _cloud9_guide: |
| 2 |
|
| 3 |
Cloud9 |
| 4 |
====== |
| 5 |
You can use AWS Cloud9 with Boto3 to write, run, and debug your Python code |
| 6 |
using just a browser. AWS Cloud9 provides an integrated development |
| 7 |
environment (IDE) that includes tools such as a code editor, |
| 8 |
debugger, and terminal. Because the AWS Cloud9 IDE is cloud based, |
| 9 |
you can work on your Python projects from your office, home, or anywhere using |
| 10 |
an internet-connected machine. For general information about AWS Cloud9, see the |
| 11 |
`AWS Cloud9 User Guide <https://docs.aws.amazon.com/cloud9/latest/user-guide>`_. |
| 12 |
|
| 13 |
Prerequisites |
| 14 |
------------- |
| 15 |
You must already have an AWS account. If you don't have one, do this |
| 16 |
to create it: |
| 17 |
|
| 18 |
#. Go to https://aws.amazon.com. |
| 19 |
#. Choose **Sign In to the Console**. |
| 20 |
#. Choose **Create a new AWS account**. |
| 21 |
#. Follow the on-screen instructions to finish creating the account. |
| 22 |
|
| 23 |
Step 1: Set up your AWS account |
| 24 |
------------------------------- |
| 25 |
Start to use AWS Cloud9 by signing in to the AWS Cloud9 console as |
| 26 |
an AWS Identity and Access Management (IAM) entity (for example, |
| 27 |
an IAM user) in your AWS account who has access permissions for AWS Cloud9. |
| 28 |
|
| 29 |
To set up an IAM entity in your AWS account to access AWS Cloud9, |
| 30 |
and to sign in to the AWS Cloud9 console, see |
| 31 |
`Team Setup <https://docs.aws.amazon.com/cloud9/latest/user-guide/setup.html>`_ |
| 32 |
in the *AWS Cloud9 User Guide*. |
| 33 |
|
| 34 |
Step 2: Create an environment |
| 35 |
----------------------------- |
| 36 |
After you sign in to the AWS Cloud9 console, use the console to |
| 37 |
create an AWS Cloud9 development environment. (A *development environment* |
| 38 |
is a place where you store your project's files and where you run the tools |
| 39 |
to develop your apps.) After you create |
| 40 |
the environment, AWS Cloud9 automatically opens the IDE for that environment. |
| 41 |
|
| 42 |
To create an AWS Cloud9 development environment, see |
| 43 |
`Creating an Environment <https://docs.aws.amazon.com/cloud9/latest/user-guide/create-environment.html>`_ |
| 44 |
in the *AWS Cloud9 User Guide*. |
| 45 |
|
| 46 |
Step 3: Set up credentials |
| 47 |
-------------------------- |
| 48 |
To call AWS services from Python code in your environment, you must provide a |
| 49 |
set of AWS authentication credentials along with each call that your |
| 50 |
code makes. If you created an AWS Cloud9 EC2 development environment |
| 51 |
in the previous step, then AWS Cloud9 automatically set up these |
| 52 |
credentials in your environment, and you can skip ahead to the next step. |
| 53 |
|
| 54 |
If, however, you created an AWS Cloud9 SSH development environment, you must |
| 55 |
manually set up these credentials in your environment. |
| 56 |
To set up these credentials, see |
| 57 |
`Call AWS Services from an Environment <https://docs.aws.amazon.com/cloud9/latest/user-guide/credentials.html>`_ |
| 58 |
in the *AWS Cloud9 User Guide*. |
| 59 |
|
| 60 |
Step 4: Install Boto3 |
| 61 |
---------------------- |
| 62 |
After AWS Cloud9 opens the IDE for your development environment, use the IDE |
| 63 |
to set up Boto3. To do this, use the terminal in the IDE to |
| 64 |
run this command: |
| 65 |
|
| 66 |
sudo pip install boto3 |
| 67 |
|
| 68 |
If the terminal isn't already open in the IDE, open it. To do this, |
| 69 |
on the menu bar in the IDE, choose **Window, New Terminal**. |
| 70 |
|
| 71 |
You can also install a specific version: |
| 72 |
|
| 73 |
sudo pip install boto3==1.0.0 |
| 74 |
|
| 75 |
.. note:: |
| 76 |
|
| 77 |
The latest development version can always be found on |
| 78 |
`GitHub <https://github.com/boto/boto3>`_. |
| 79 |
|
| 80 |
Step 5: Download example code |
| 81 |
----------------------------- |
| 82 |
Use the terminal that you opened in the previous step, download example code |
| 83 |
for Boto3 into your AWS Cloud9 development environment. To do this, |
| 84 |
use the terminal in the IDE to run this command: |
| 85 |
|
| 86 |
git clone https://github.com/awsdocs/aws-doc-sdk-examples.git |
| 87 |
|
| 88 |
This command downloads |
| 89 |
a copy of many of the code examples used across the official AWS SDK |
| 90 |
documentation into your environment's root directory. |
| 91 |
|
| 92 |
To find the code examples for Boto3, use the **Environment** window to open |
| 93 |
the :code:`your-environment-name/aws-doc-sdk-examples/python/example_code` |
| 94 |
directory, where :code:`your-environment-name` is the name of your |
| 95 |
development environment. |
| 96 |
|
| 97 |
To learn how to work with these and other code examples, see |
| 98 |
:ref:`Code Examples <aws-boto3-examples>`. |
| 99 |
|
| 100 |
Step 6: Run and debug code |
| 101 |
-------------------------- |
| 102 |
To run your Python code in your AWS Cloud9 development environment, see |
| 103 |
`Run Your Code <https://docs.aws.amazon.com/cloud9/latest/user-guide/build-run-debug.html#build-run-debug-run>`_ |
| 104 |
in the *AWS Cloud9 User Guide*. |
| 105 |
|
| 106 |
To debug your Python code, see |
| 107 |
`Debug Your Code <https://docs.aws.amazon.com/cloud9/latest/user-guide/build-run-debug.html#build-run-debug-debug>`_ |
| 108 |
in the *AWS Cloud9 User Guide*. |
| 109 |
|
| 110 |
Next steps |
| 111 |
---------- |
| 112 |
Explore these resources to learn more about AWS Cloud9: |
| 113 |
|
| 114 |
* Experiment with the |
| 115 |
`Python Sample <https://docs.aws.amazon.com/cloud9/latest/user-guide/sample-python.html>`_ |
| 116 |
in the *AWS Cloud9 User Guide*. |
| 117 |
* Learn how to use the AWS Cloud9 IDE by completing the |
| 118 |
`IDE Tutorial <https://docs.aws.amazon.com/cloud9/latest/user-guide/tutorial.html>`_ |
| 119 |
in the *AWS Cloud9 User Guide*. |