Lab 3 aws 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 you’ve taken and include the screenshots requested.

Step 1: Explore AWS APIs and Python SDK for AWS

1. Python (h”ps://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 objects—units of func!onality and associated data—and use them.

Python APIs provide libraries of classes—blueprints for objects—that model en!!es in the API’s

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 (h”ps://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

(h”ps://boto3.amazonaws.com/v1/documenta!on/api/latest/index.html) .”

3. Log in to your AWS Educate account. Click on the “My Classrooms” bu”on at the bo”om of the screen,

and go to the CCA 625 classroom. Click on the “AWS Console” bu”on.

4. On the AWS Services page, under the “Developer Tools” sec!on at the bo”om, 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

https://www.python.org/https://aws.amazon.com/sdk-for-python/https://boto3.amazonaws.com/v1/documentation/api/latest/index.html

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/course…t-2–lab-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.

https://leocontent.umgc.edu/content/dam/course-content/tgs/cca/cca-625/document/create_instance.py?ou=602744

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/course…t-2–lab-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 12–14: 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

(h”ps://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

you’ve 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.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html%23EC2.Client.run_instances

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/course…t-2–lab-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 you’ve 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.

Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more