<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 眼鏡蛇 閱讀(378) 評論(0)  編輯  收藏 所屬分類: AWS

    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導航

    統計

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 成人毛片免费观看视频大全| 女人18毛片特级一级免费视频| 久久精品亚洲视频| 9420免费高清在线视频| 亚洲精品视频在线播放| 精品免费久久久久久成人影院| 在线91精品亚洲网站精品成人| 亚洲精品视频免费观看| 精品国产一区二区三区免费| 亚洲入口无毒网址你懂的| 四虎影视永久免费视频观看| 国产在线观看免费视频软件| 亚洲av无码不卡久久| 亚洲日韩精品一区二区三区无码| 91免费国产自产地址入| 一级**爱片免费视频| 中国亚洲呦女专区| 亚洲av日韩av无码| 亚洲午夜爱爱香蕉片| AV片在线观看免费| 无码A级毛片免费视频内谢| 精品女同一区二区三区免费播放| 亚洲成a人片在线网站| 亚洲精品无码av人在线观看| 国产免费啪嗒啪嗒视频看看| 永久免费在线观看视频| 免费a级毛片无码a∨免费软件| 国产亚洲视频在线| 亚洲成a人片在线观看天堂无码 | 亚洲日本一区二区| 亚洲一区二区女搞男| 国产成人精品123区免费视频| 精品国产无限资源免费观看| 四虎国产精品永久免费网址| 一级一片免费视频播放| 无码免费又爽又高潮喷水的视频 | 四虎影视大全免费入口| 皇色在线视频免费网站| av无码久久久久不卡免费网站| 亚洲精品免费观看| 日本人的色道免费网站|