Install Web App

Install Web App

The Web App is very simple python web server that works as a shared file server, for internal employees for example. It allows to upload and download files to/from S3. For downloads the Web App keeps a local file in the instance where Web App is running, prefixing the file with “localfile-”.

Our instance has a role with a policy attached to it that allow to read/write from S3.

  1. Execute the command pwd to check Home Directory Install Web App
  2. Execute the below command to install Pip library
sudo easy_install pip==20.3.4

Install Web App 3. Execute the below command to check Pip version.

pip3 --version

Install Web App 4. Execute the below command to create the folder to work and install boto3 library in it

sudo mkdir SampleWebApp

Install Web App 5. Execute the below command to install boto3 library

sudo pip install boto3

Install Web App 6. Execute the below command to access folder SampleWebApp then download the template of Web App

cd SampleWebApp/
sudo wget  https://raw.githubusercontent.com/aws-samples/aws-kms-workshop/master/WebApp.py

Install Web App 7. Execute the below command to check the connection and get the Public IP of the Instance

sudo curl http://169.254.169.254/latest/meta-data/public-ipv4/

Install Web App 8. Execute the below command to run Web server

sudo curl http://169.254.169.254/latest/meta-data/public-ipv4/

Install Web App 9. Add a Security Group allow HTTP traffic into KMSWorkshop-Instance .

  • Go to Amazon EC2 console.
  • On the left navigation bar, Click Security Groups.
  • Select Create security group. Install Web App
  1. In the Basic details section
  • In the Security group name section, type KMSWorkshopGroup.
  • In the Description section, type KMSWorkshopGroup. Install Web App
  1. In the Inbound rules section, click Add rule.
  • In the Type section, Select HTTP
  • In the Source section, Select 0.0.0.0/0.
  • Click Add rule to add a new rule.
  • In the Type section, Select HTTP
  • In the Source section, Select ::/0. Install Web App
  • Drag the screen down, Click Create Security Group.
  1. Add Security Group select KMSWorkshop-Instance
  • Go to Amazon EC2 console.
  • On the left navigation bar, select Intances.
  • Select KMSWorkshop-Instance.
  • Click Actions
  • Click Security
  • Click Change security group Install Web App
  1. In the Associated security groups section
  • Type KMSWorkshop-AdditionalPermissions into the search bar
  • Select KMSWorkshop-AdditionalPermissions
  • Click Add security group
  • Click Save Install Web App
  1. Go to Web App by Public IP http://54.221.111.102 Install Web App
  • The Web app consist 3 section:
  • File Uploader: allow upload file into S3
  • Files in S3 : show the file list in the S3 bucket
  • Files in local : show the file list in the Web App server.
  1. In our laptop, create file SampleFile-KMS.txt
  • Click Browse, Select file SampleFile-KMS.txt
  • Click upload Install Web App
  1. In the Web App home, we see file SampleFile-KMS.txt in section FILES in S3 Install Web App