<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    create AWS Cloud9 environment

    In this exercise, you will create your first AWS Cloud9 environment and start building the first component of the course project. AWS Cloud9 is a cloud-based IDE that lets you write, run, and debug your code with just a browser. 
    Note: Make sure to sign in to your AWS account with the AWS IAM user edXProjectUser credentials.

    Architecture Diagram

    Architecture Diagram

    The diagram shown above is the architecture diagram for the application you will build over the duration of the course. The course project is a simple web application in which users log in to their accounts and upload photos to an Amazon S3 bucket, process the photos with Amazon Rekognition to generate labels and then store the photos along with their labels and description in an Amazon RDS database.

    The application is deployed on an Amazon EC2 instance with an Application Load Balancer sitting in front of the instance to direct user requests to the instance. Amazon Cognito is used to sign up/sign in users for the application. In order to asynchronously process the photo labels, when a photo is uploaded, an Amazon S3 bucket event notification is issued to an Amazon SNS topic. This triggers a subscribed AWS Lambda function, which talks to Amazon Rekognition. To make the application more distributed, an Amazon SQS queue subscribed to the Amazon SNS topic stores all the incoming requests and an on-premises application polls the queue for processing. AWS X-Ray traces the calls made to all the AWS resources in this application, thereby providing diagnostics information. The application is coded in Python 3 using AWS Cloud9 as the IDE.

    In this exercise, you will build the Amazon S3 uploader component of the application. In this component, users will upload a photo to an Amazon S3 bucket.

    To begin, follow the instructions below.

    1. Create AWS Cloud9 environment and explore the environment.

    In this section, you will create an AWS Cloud9 environment and explore the environment.

    • In the AWS Console, click Services, then click Cloud9 to open the Cloud9 dashboard.
    • Make sure you are in the Oregon region.
    • Click Create environment at the top-right corner.
    • For Name, type BuildingOnAWS
    • Click Next step.
    • On the Configure settings page, leave the default selection in the Environment settings section and scroll down to Network settings (advanced).
    • For Network (VPC), choose the edx-build-aws-vpc id you wrote down in the third exercise.
    • For Subnet, choose the public subnet in edx-build-aws-vpc with the subnet-id you noted in the third exercise.
    • Click Next step.
    • Review the details and click Create environment. This should launch your AWS Cloud9 environment in a few minutes.
    • Upon environment creation, notice the terminal window on the bottom pane. The terminal provides a remote login to the instance on which the AWS Cloud9 environment is hosted, just as you used SSH for remote login in the third exercise. A pre-authenticated AWS CLI is installed in your terminal.
    • Explore the terminal by typing this command:

      aws ec2 describe-instances

      This should give a JSON output with the all the information of the EC2 instances in your account.
    • Install Boto 3 on your AWS Cloud9 instance by typing this command:
    • sudo pip-3.6 install boto3

    • At the terminal, type python3 and press ENTER.
    • Explore the Python Boto 3 APIs by executing these commands:
    • import boto3
      client = boto3.client('ec2')
      client.describe_instances()

    • Press CTRL+D to exit the Python interpreter.

    2. Create an Amazon S3 bucket to store the application photos.

    In this section, you will create an Amazon S3 bucket in your AWS account. This bucket will store your application photos. If you are familiar with Amazon S3, you may want to attempt to complete this section by using the properties below before reading the step-by-step instructions.

    Region: Oregon (us-west-2) 
    Bucket name: Type a unique bucket name to store photos and make a note of it for later use. 

    • In the AWS Console, click Services, then click S3 to open the S3 dashboard.
    • Click Create bucket.
    • For Bucket name, type a unique bucket name to store photos. Write down the name of the bucket for later use.
    • For Region, make sure you have selected the Oregon (us-west-2) region.
    • Click Create.

    3. Build the Amazon S3 uploader component of the application in the AWS Cloud9 environment.

    In this section, you will build the Amazon S3 uploader component of the application. The Amazon S3 uploader component uploads photos to the Amazon S3 bucket you created in the previous section.

    • Type the command below in your AWS Cloud9 terminal to make sure you are in the ~/environment directory of your AWS Cloud9 instance.

      cd ~/environment
    • Type the command below in your AWS Cloud9 terminal to download the Python code for the Amazon S3 uploader component.

      wget https://us-west-2-tcdev.s3.amazonaws.com/courses/AWS-100-ADG/v1.0.0/exercises/ex-s3-upload.zip

      On the left tree view, you should see the exercise code .zip file named ex-s3-upload.zip.
    • Unzip the exercise code .zip file by typing the command below in your AWS Cloud9 terminal.

      unzip ex-s3-upload.zip

      The contents of the .zip file should be extracted to a folder with a similar name. You can view the folder on the left tree view.
    • Open the exercise-s3-upload/FlaskApp/application.py file and review the code. Notice that an Amazon S3 client has been created to interact with Amazon S3 via the Boto 3 API.
    • Install the requirements for the project by executing the command below in your AWS Cloud9 terminal.
    • sudo pip-3.6 install -r exercise-s3-upload/FlaskApp/requirements.txt

    • To run the application.py code:
      • Select exercise-s3-upload/FlaskApp/application.py in the tree view.
      • On the top menu bar, click Run -> Run With -> Python 3. Ensure that you are using the Python 3 runner, as shown in the screenshot below. 
      • You should see an error message asking for an environment variable named PHOTOS_BUCKET.
      • To successfully run the code, you will need to set environment variables. To do so, follow the instructions below:
      • On the right side of the Run Configuration pane at the bottom, click ENV, as in the screenshot below. 
      • In the Name column, type PHOTOS_BUCKET
      • In the Value column, type the name of the Amazon S3 bucket you created earlier.
        Note: Make sure to delete any white space that was inserted while copy/pasting.
      • In the Name column, type FLASK_SECRET
        The Flask app uses a secret value to encrypt session variables.
      • In the Value column, type random characters and numbers.
      • Save the run configuration by typing a name for the configuration. This saves the run configuration with all the environment variables and the runner information. In the text box next to the Run button, type Python3RunConfiguration, as shown in the screenshot below.
      • Run application.py again. This time, it should run successfully. In the terminal, you will see a message like this: 

        Running on http://0.0.0.0:5000/

        That means the Python Flask app is now running on port 5000 of the AWS Cloud9 instance.
    • To verify that the app is running, you will need to edit the security group of the AWS Cloud9 instance. Go to the EC2 dashboard, locate your AWS Cloud9 instance, and select it.
    • In the Description pane at the bottom, click the security group hyperlink. This should open up the security group associated with the AWS Cloud9 instance.
    • On the bottom pane, click Inbound.
    • Click Edit.
    • Click Add Rule.
    • For Port Range, type 5000
    • For Source, type 0.0.0.0/0
    • Click Save.
    • Return to your AWS Cloud9 environment. On the top-right corner, click Share, as shown in the screenshot below.
    • Copy the IP address displayed in front of Application. This is the public IP address of the AWS Cloud9 instance.
    • Go to your browser and type the IP address of the AWS Cloud9 instance followed by :5000 The uploaded component of the project is now up and running!
    • Try uploading a few photos via the app. You will notice that the photos are stored in the Amazon S3 bucket that you created earlier. 
      Note: Your AWS Cloud9 instance has been configured to auto-hibernate your environment to prevent unnecessary charges.

    Optional Challenge

    The Boto 3 list_objects method returns a LastModified property. Can you update the application to display photos in LastModified order?




    眼鏡蛇

    posted on 2018-04-19 11:15 眼鏡蛇 閱讀(365) 評(píng)論(0)  編輯  收藏 所屬分類: AWS

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲 自拍 另类小说综合图区| 亚洲欧美日韩中文高清www777| 国产一区二区三区在线免费观看| 午夜影院免费观看| 特级做a爰片毛片免费看| 亚洲一级毛片免费看| 亚洲成a人片在线观看无码专区| 日本免费人成黄页在线观看视频| 91香蕉在线观看免费高清| 插鸡网站在线播放免费观看| 国产区图片区小说区亚洲区| 国产成人精品日本亚洲11| 久久久亚洲欧洲日产国码是AV| 亚洲午夜久久久久妓女影院| 亚洲精品动漫人成3d在线| 国产一区视频在线免费观看| 毛片a级毛片免费播放下载 | 国产精品成人无码免费| 青青青国产在线观看免费网站| 特级无码毛片免费视频尤物| 久久青草91免费观看| 丁香花在线视频观看免费| 久久嫩草影院免费看夜色| 一区二区免费国产在线观看| 免费VA在线观看无码| 男男黄GAY片免费网站WWW| 国产成人va亚洲电影| 黄色免费网址大全| 四虎影视永久在线精品免费 | 亚洲精品国产高清嫩草影院| 国产高清免费观看| 又爽又高潮的BB视频免费看| 国产免费资源高清小视频在线观看| 波多野结衣久久高清免费 | 亚洲AV无码无限在线观看不卡| 亚洲二区在线视频| 亚洲 欧洲 自拍 另类 校园| 亚洲综合精品成人| 亚洲乱色伦图片区小说| 91九色视频无限观看免费| 2021在线永久免费视频|