In: Computer Science
3. Describe how to deploy applications over commercial cloud computing infrastructures:
1) Amazon Web Services,
2) Windows Azure,
3) Google AppEngine
ANSWER 1
You will use AWS CodeDeploy, a service that automates code deployments to AWS or on-premises servers, to deploy code to virtual machines that you create and manage with Amazon EC2.
Everything done in this tutorial is free tier eligible.
Manage Your AWS Resources
Sign in to the Console
Step 1: Create a Key Pair
You will need to create a key pair to access your virtual machine with Amazon EC2. If you already have a key pair, skip ahead to Step 2.
a. When you click here, the AWS Management Console will open in a new browser window, so you can keep this step-by-step guide open. Click Create Key Pair.
(click to zoom)
b. Name your key pair. For this tutorial, we will use MyFirstKey. Click Create.
Note: Amazon EC2 uses public-key cryptography to encrypt and decrypt login information. To learn more about key pairs, see Amazon EC2 Key Pairs.
(click to zoom)
Step 2: Enter the CodeDeploy Console
a. Click the home icon on the upper left corner of the AWS Management Console. Find CodeDeploy under Developer Tools and click to open the AWS CodeDeploy Console.
(click to zoom)
b. In the AWS CodeDeploy Console, click Get Started Now.
If you already have applications, look to the right column and click Create Deployment Walkthrough.
(click to zoom)
c. Select Sample Deployment and click Next.
(click to zoom)
Step 3: Launch a Virtual Machine
You will need to launch an AWS virtual machine to deploy your code on. AWS virtual machines are known as Amazon EC2 instances, or just 'instances' for short. In this step, we will launch three EC2 instances using a pre-configured EC2 template.
a. Click the home icon on the upper left corner of the AWS Management Console. Find CodeDeploy under Developer Tools and click to open the AWS CodeDeploy Console.
(click to zoom)
You will configure your instance settings with the options below:
Click Launch Instances.
Note: This step may take several minutes to complete. As you wait, feel free to review this tutorial with the video below:
2:10
AWS CodeDeploy Walkthrough
(click to zoom)
Step 4: Name Your Application and Review Your Application Revision
AWS CodeDeploy uses application names during code deployments to make sure it is referencing the correct deployment components, such as the deployment group, deployment configuration, and application revision.
a. In the Application Name box, enter HelloWorld as the name for your sample application and click Next Step.
(click to zoom)
b. Review information about your application revision, such as its location and description.
Note: You have the option to download the sample bundle. In this view, you can review information about the application revision you’d like to deploy to EC2. An application revision is an archive file containing source content—such as source code, web pages, executable files, and deployment scripts—along with an application specification file (AppSpec file). The AppSpec file helps CodeDeploy map the source files in your revision to their destinations and run scripts at various stages of the deployment.
Click Next Step
(click to zoom)
Step 5: Create a Deployment Group
A deployment group is a set of individual EC2 instances that CodeDeploy deploys revisions to. A deployment group contains individually tagged instances, Amazon EC2 instances in Auto Scaling groups, or both.
In the Deployment Group Name box, leave the proposed deployment group name (DemoFleet) as is.
You will then specify the Amazon EC2 instances to deploy by entering the key-value pair in the Seach by Amazon EC2 Tags section:
Choose Next Step.
(click to zoom)
Step 6: Create a Service Role
In this step, you will grant AWS CodeDeploy permission to deploy to your instances. You create a role for an AWS service when you want to grant permissions to a service like Amazon EC2 or AWS CodeDeploy. These services can access AWS resources, so you create a role to determine what the service is allowed to do with those resources.
Service Role: Choose Create a new service role. If you already have a service role, you can choose Use an existing service role.
Role Name: You can accept default value of CodeDeploy_HelloWorld. If you are using an existing service role, choose it from the Role Name drop-down list.
Click Next Step.
(click to zoom)
Step 7: Deploy Your Application
In this step, we will select a deployment configuration and then initiate the deployment to our three EC2 instances. By the end of this step, we'll have successfully deployed a live and running website, which we can visit online.
a. The deployment configuration lets you determine how many instances to simultaneously deploy your application revisions to and describes the success and failure conditions for the deployment. For example, using the default configuration (“One at a Time”), if you deploy your application to 3 instances, this configuration will deploy to one instance at a time.
Accept the Default Deployment Configuration and click Next Step.
(click to zoom)
b. Review the details of your deployment and click Deploy Now.
Note: This can take several minutes to complete.
(click to zoom)
c. Our sample revision deploys a single web page to each instance. Once all three instances are completed, click View All Instances.
(click to zoom)
d. Click the instance ID for one of the instances you deployed to. This will take you to the EC2 dashboard where you can view the instance that you launched.
(click to zoom)
e. To verify whether your sample application deployed successfully, copy the address in the Public DNS field in the bottom panel, paste the address into your browser, and you will see your live web page.
(click to zoom)
Step 8: Clean Up Your Instances
To avoid future charges, you must clean up the resources used in this tutorial. The EC2 instances you launched for this tutorial will keep running unless you terminate them.
a. In the EC2 console, the search bar is autopopulated with a search filter for the Instance ID. Delete this filter and you will see all the instances launched by CodeDeploy.
(click to zoom)
b. Select the boxes of each Amazon EC2 instance to terminate. Select Actions, Instance State, and click Terminate.
When prompted, click Yes, Terminate.
ANSWER 2
Create a Deployment Package
Step 1 − Go to your website in Visual Studio.
Step 2 − Right-click on the name of the application in the solution explorer. Select ‘Publish’.
Step 3 − Create a new profile by selecting ‘New Profile’ from the dropdown. Enter the name of the profile. There might be different options in dropdown depending on if the websites are published before from the same computer.
Step 4 − On the next screen, choose ‘Web Deploy Package’ in Publish Method.
Step 5 − Choose a path to store the deployment package. Enter the name of site and click Next.
Step 6 − On the next screen, leave the defaults on and select ‘publish’.
After it’s done, inside the folder in your chosen location, you will find a zip file which is what you need during deployment.
Create a Website in Azure using PowerShell
Step 1 − Enter the following cmdlets to create a website. Replace the highlighted part. This command is going to create a website in free subscription. You can change the subscription after the website is created.
New-AzureWebsite -name "mydeploymentdemo" -location "East US"
If cmdlet is successful, you will see all the information as shown in the above image. You can see the URL of your website as in this example it is mydeploymentdemo.azurewebsites.net.
Step 2 − You can visit the URL to make sure everything has gone right.
Deploy Website using Deployment Package
Once the website is created in Azure, you just need to copy your website’s code. Create the zip folder (deployment package) in your local computer.
Step 1 − Enter the following cmdlets to deploy your website.
Publish-AzureWebsiteProject -name "mydeploymentdemo" -package "C:\Users\Sahil\Desktop\deploymentDemo\MyWebsiteOnAzure.zip"
Here in above commandlet, the name of the website just created is given and the path of the zip file on the computer.
Step 2 − Go to your website’s URL. You can see the website as shown in the following image.
ANSWER 3
Deploying the Application
This part of the Python Guestbook code walkthrough shows how to deploy the application to App Engine.
This page is part of a multi-page tutorial. To start from the beginning and see instructions for setting up, go to Creating a Guestbook.
Deploying the app to App Engine
To upload the guestbook app, run the following command from
within the appengine-guestbook-python
directory of
your application where the app.yaml
and
index.yaml
files are located:
gcloud app deploy app.yaml index.yaml
Optional flags:
--project
flag to specify an alternate
Cloud Console project ID to what you initialized as the default in
the gcloud
tool. Example: --project
[YOUR_PROJECT_ID]
-v
flag to specify a version ID,
otherwise one is generated for you. Example: -v
[YOUR_VERSION_ID]
The Datastore indexes might take some time to generate before
your application is available. If the indexes are still in the
process of being generated, you will receive a
NeedIndexError
message when accessing your app. This
is a transient error, so try a little later if at first you receive
this error.
To learn more about deploying your app from the command line, see Deploying a Python App.
Viewing your deployed application
To launch your browser and view the app at
https://PROJECT_ID.REGION_ID.r.appspot.com
, run the
following command:
gcloud app browse
Dear student we are directed to solve one question in case more than one questions are asked by the students you have asked 2 different questions which is wrong .we are directed to solve only the sub part of the question subject to maximum of 4 which is not the case and directed not to solve the multiple question.
Anyway, i have solved all of your questions.
don't forget to give rating