This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import boto3 | |
from time import sleep | |
sqs = boto3.client('sqs') | |
queue_url = os.getenv("QUEUE_URL") | |
def fib(num): | |
if num <= 1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_api_gateway_rest_api" "api" { | |
name = "recognition-api" | |
} | |
resource "aws_api_gateway_resource" "search" { | |
path_part = "search" | |
parent_id = aws_api_gateway_rest_api.api.root_resource_id | |
rest_api_id = aws_api_gateway_rest_api.api.id | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import uuid | |
import boto3 | |
import base64 | |
from rekognition_image import RekognitionCollection, RekognitionImage | |
rekognition = boto3.client('rekognition') | |
s3_resource = boto3.resource('s3') | |
dynamodb = boto3.resource('dynamodb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_lambda_function" "search_function" { | |
function_name = "personnel-recognition-searcher" | |
role = aws_iam_role.search_function.arn | |
publish = true | |
runtime = "python3.8" | |
handler = "search_function.lambda_handler" | |
memory_size = 512 | |
timeout = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_iam_policy_document" "search_role_policy" { | |
version = "2012-10-17" | |
statement { | |
effect = "Allow" | |
actions = [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents", | |
"rekognition:DescribeCollection", | |
"rekognition:SearchFacesByImage", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws s3 cp file-to-be-upload.jpg s3://your-awesome-bucket/photos/portrait/ --metadata x-amz-meta-name=Mehmet,x-amz-meta-surname=Gungoren |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"FaceId": "348586d5-c211-42da-91b7-0fff3cf1c884", | |
"age": "18 - 26", | |
"bounding_box": { | |
"Height": 0.35801962018013, | |
"Left": 0.3011908531188965, | |
"Top": 0.19286587834358215, | |
"Width": 0.36411821842193604 | |
}, | |
"bucket": "my-company-personnel-storage-wanted-amoeba", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import boto3 | |
from decimal import Decimal | |
from urllib.parse import unquote_plus | |
from rekognition_image import RekognitionCollection, RekognitionImage | |
rekognition = boto3.client('rekognition') | |
s3_resource = boto3.resource('s3') | |
dynamodb = boto3.resource('dynamodb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_lambda_permission" "s3_permission_to_trigger_lambda" { | |
statement_id = "AllowExecutionFromS3Bucket" | |
action = "lambda:InvokeFunction" | |
function_name = aws_lambda_function.index_function.arn | |
principal = "s3.amazonaws.com" | |
source_arn = module.personnel_bucket.s3_bucket_arn | |
} | |
resource "aws_s3_bucket_notification" "incoming" { | |
bucket = module.personnel_bucket.s3_bucket_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_iam_policy_document" "index_role_policy" { | |
version = "2012-10-17" | |
statement { | |
effect = "Allow" | |
actions = [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents", | |
"rekognition:DescribeCollection", | |
"rekognition:IndexFaces", |
NewerOlder