Application Programming Interfaces
PMCCA 625 Project 2: Lab 3 AWS Application Programming Interfaces
CCA 625 Project 2: Lab 3 AWS Applica!on Programming Interfaces
In this lab exercise, you will perform the following steps:
1. Explore AWS APIs and Python SDK for AWS, and install Python SDK in your ASW Cloud9
environment.
2. Analyze a Python script, provisioning an EC2 instance.
3. Run a Python script, provisioning an EC2 instance, and analyze output.
4. Verify that instance has been provisioned.
You will write a lab report describing the steps youve taken and include the screenshots requested.
Step 1: Explore AWS APIs and Python SDK for AWS
1. Python (hps://www.python.org/) is a programming language that has gained popularity in recent
years. Most of its implementa!ons involve a direct or indirect interpreter, so it is not compiled into the
machine-level language. Programmers like Python because it can be successfully used both for wri!ng
short scripts and also in complex so#ware systems. Python is an object-oriented language.
Programmers can create so#ware objectsunits of func!onality and associated dataand use them.
Python APIs provide libraries of classesblueprints for objectsthat model en!!es in the APIs
business domain and provide opera!ons to be carried out on these en!!es.
2. AWS provides a so#ware development kit (SDK) for Python (hps://aws.amazon.com/sdk-for-
python/) , which means that there https://paperwriters.xyz/uncategorized/lab-3-aws-application-programming-interfaces/ is a library of Python classes corresponding to AWS resources, and
cloud developers can invoke opera!ons on objects created from these classes. The SDK is called boto
and the latest version is boto3
(hps://boto3.amazonaws.com/v1/documenta!on/api/latest/index.html) .
3. Log in to your AWS Educate account. Click on the My Classrooms buon at the boom of the screen,
and go to the CCA 625 classroom. Click on the AWS Console buon.
4. On the AWS Services page, under the Developer Tools sec!on at the boom, select the Cloud9
service. In the Cloud9 dashboard, you should see the CCA625_<your ini!als> Cloud9 Ubuntu
environment you created in Lab 1. Click on it and wait un!l the Cloud9 IDE screen opens.
5. Cloud9 comes with the Python language installed, along with the Python module installer called pip,
but the AWS boto3 SDK is not installed. Type pip install boto3 in the bash console tab and wait un!l
the SDK is installed.
Course Resource
6/12/21, 3:48 PMCCA 625 Project 2: Lab 3 AWS Application Programming Interfaces
Page 2 of 4https://leocontent.umgc.edu/content/umuc/tgs/cca/cca625/2212/courset-2lab-3-aws-application-programming-interfaces-.html?ou=602744#
Source: Amazon Web Services
Step 2: Analyze a Python Script, Provisioning an EC2 Instance
6. Download to your computer this Python script: create_instance.py (/content/dam/course-
content/tgs/cca/cca-625/document/create_instance.py?ou=602744)
7. In Cloud9, click on File Upload Local Files, and upload the script to your Cloud9 environment.
8. Click on the create_instance.py file in your environment file tree on the le#. It opens in a text editor
tab.
Source: Amazon Web Services
Analyze the script:
Lines 2, 3: The boto3 Python SDK module components are made available to the script.
6/12/21, 3:48 PMCCA 625 Project 2: Lab 3 AWS Application Programming Interfaces
Page 3 of 4https://leocontent.umgc.edu/content/umuc/tgs/cca/cca625/2212/courset-2lab-3-aws-application-programming-interfaces-.html?ou=602744#
Line 9: The client object for the EC2 service is created. This object provides methods for invoking
ac!ons of the EC2 service.
Lines 1214: Values of parameters needed for instance crea!on are defined. Image_id specifies the
Ubuntu 18.1 image. You need to type in the name of your key pair available in your student account.
Create one in the AWS console in the EC2 service under Key Pairs if needed.
Line 18: This is the call to the run_instances method of the EC2 Python service
(hps://boto3.amazonaws.com/v1/documenta!on/api/latest/reference/services/ec2.html#EC2.Client.run_instances)
to create a single EC2 instance. All required parameters are specified, plus an op!onal name tag to be
able to tell your instance in the instance list in the console.
Line 36: The result is printed, which is the Python dic!onary (list of key-object pairs) containing
informa!on about the instance being provisioned.
Line 39: In case of an error being raised, the error object is thrown, which is printed.
Step 3: Run a Python Script Provisioning an EC2 Instance and Analyze Output
9. In the editor tab, line 14, https://paperwriters.xyz/uncategorized/lab-3-aws-application-programming-interfaces/ type in the name of your key pair inside single quotes. You can use the keypair
youve used in Project 1 Lab 3 Step 10. Take a screenshot and include it in your lab report.
10. Close the text editor tab with the modified script and save it.
11. Maximize the bash command terminal tab, type python create_instance.py at the command prompt,
and hit Enter. If the script executes successfully, you will see the instance informa!on dic!onary.
Confirm that the instance has the proper image, type, key pair name, and tag. Take a screenshot and
include it in your lab report.
6/12/21, 3:48 PMCCA 625 Project 2: Lab 3 AWS Application Programming Interfaces
Page 4 of 4https://leocontent.umgc.edu/content/umuc/tgs/cca/cca625/2212/courset-2lab-3-aws-application-programming-interfaces-.html?ou=602744#
Source: Amazon Web Services
12. In case of an error, you will see an error message. Fix the error and run the script again.
Step 4: Verify the Instance Has Been Provisioned
13. To verify that the instance is provisioned, go back to the AWS console, select the EC2 service, and click
on the Instances label on the le#. Select the instance created by the Python script. Take a screenshot
and include it in your lab report.
14. Write and submit the lab report, showing the steps youve taken and all requested screenshots with
brief explana!ons. Submit the lab report in the Project 2 Step 4 submission box.
15. A#er you are done and your Project 2 report is graded, remember to terminate the instance associated
with the Cloud9 environment, and delete the Cloud9 environment.
2021 University of Maryland Global Campus
All links to external sites were verified at the !me of publica!on. UMGC is not responsible for the validity or integrity of informa!on located at
external sites.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
