Skip to content

Capture images using webcam and store it to Amazon S3 bucket.

Notifications You must be signed in to change notification settings

UMANG2707/AWS-WebCam-Capute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS-WebCam-Capute

Capture images using webcam and store it to Amazon S3 bucket.

two step process.

ec2-s3

1. Create S3 bucket and store captured images to the s3 bucket using "aws-sdk for PHP".

2. Create Ec2 instacme and host this web into it.


1. Create S3 bucket and store captured images to the s3 bucket using "aws-sdk for PHP".

download

  • Create simple web application which capture images and store it into local machine[As per our code it's look like this].

    • index.php

      aa
    • webcam.php

      b
  • Open AWS consol and create IAM and S3 bucket

    • Create IAM user with programmatic access and save ACCESS KEY and SECRET ACCESS KEY.

    • Create s3 bucket.

    • Then click Bucket Policy.

      1 2
    • Set your Bucket Policy to be the same as below. Change User Arn to be your User ARN. Also change Bucket Arn to your Bucket ARN. The bucket ARN is above the textarea.

      {
          "Version": "2012-10-17",
          "Id": "Policy1488494182833",
          "Statement": [
                  {
                      "Sid": "Stmt1488493308547",
                      "Effect": "Allow",
                      "Principal": {
                      "AWS": "User Arn"
                  },
                  "Action": [
                      "s3:ListBucket",
                      "s3:ListBucketVersions",
                      "s3:GetBucketLocation",
                      "s3:Get*",
                      "s3:Put*"
                  ],
                  "Resource": "Bucket Arn"
                  }
              ]
          }
          ```
      
    • Click CORS configuration and add the following policy:

      <?xml version="1.0" encoding="UTF-8"?>
      <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <CORSRule>
          <AllowedOrigin>*</AllowedOrigin>
          <AllowedMethod>GET</AllowedMethod>
          <AllowedMethod>POST</AllowedMethod>
          <AllowedMethod>PUT</AllowedMethod>
          <MaxAgeSeconds>3000</MaxAgeSeconds>
          <AllowedHeader>Authorization</AllowedHeader>
        </CORSRule>
      </CORSConfiguration>
      
    • Click on the New inline policy

      4
    • Update the policy to be as follows:

      3
      {
          "Version": "2012-10-17",
          "Statement": [
              {
                  "Effect": "Allow",
                  "Action": [
                      "s3:ListAllMyBuckets",
                      "s3:PutObject",
                      "s3:GetObject"
                  ],
                  "Resource": [
                      "arn:aws:s3:::*"
                  ]
              }
          ]
      }
      
    • open storeimage.php

      • Replace bucket name, Access key and Secret access with yours also give region and version.

        asd
  • Download aws-sdk for PHP and connect S3 bucket with web application.

    • Download composer and intall it. (https://getcomposer.org/Composer-Setup.exe)
    • Open root folder of your project and start cmd from location of that folder.
    • Run below command to download and install aws-sdk for PHP.
      • composer require aws/aws-sdk-php

2. Create Ec2 instance and host this web into it.


About

Capture images using webcam and store it to Amazon S3 bucket.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published