<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)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 丁香六月婷婷精品免费观看| 亚洲成a人片在线观看国产| 久久亚洲AV午夜福利精品一区| 91在线老王精品免费播放| 日韩色视频一区二区三区亚洲| 国产亚洲精品自在久久| 大学生a级毛片免费观看| 日韩免费视频一区二区| 日韩免费高清一级毛片| 亚洲成人黄色在线| 久久亚洲精品AB无码播放| 免费人成年轻人电影| 国产美女精品久久久久久久免费 | 免费无码成人AV片在线在线播放| 国产国产人免费人成成免视频| 爱情岛论坛亚洲品质自拍视频网站 | 亚洲色精品vr一区二区三区| 在线看片v免费观看视频777| 国产永久免费高清在线| 人妻巨大乳hd免费看| 一级a性色生活片久久无少妇一级婬片免费放| 亚洲精品一卡2卡3卡三卡四卡| 亚洲视频在线观看不卡| 亚洲系列中文字幕| 亚洲天堂免费在线| 中文字幕亚洲码在线| 亚洲精品乱码久久久久久蜜桃图片| 色在线亚洲视频www| 亚洲AV无码一区二区三区性色| 美女免费视频一区二区| 亚洲av午夜国产精品无码中文字| 亚洲爆乳精品无码一区二区| 国产成人亚洲精品播放器下载| 国产精品久久久久久亚洲小说| 春意影院午夜爽爽爽免费| 国产免费牲交视频免费播放| 国产精品99久久免费观看| 在线视频观看免费视频18| 免费看国产精品麻豆| 亚洲精品无码av人在线观看 | 亚洲成a人片在线观看天堂无码 |