Skip to content

Commit

Permalink
Merge pull request #68 from FullStackWithLawrence/next
Browse files Browse the repository at this point in the history
add Services class
  • Loading branch information
lpm0073 authored Dec 23, 2023
2 parents 8bade96 + db8b9ef commit 060e257
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 69 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## [0.2.10](https://github.com/FullStackWithLawrence/aws-rekognition/compare/v0.2.9...v0.2.10) (2023-12-22)


### Bug Fixes

* add policy attchments to roles. add a config to apigateway session w longer timeout ([ef2ffb7](https://github.com/FullStackWithLawrence/aws-rekognition/commit/ef2ffb7ee6ad76205d95ea5d1e2e7bba9ef3ab3d))
- add policy attachments to roles. add a config to apigateway session w longer timeout ([ef2ffb7](https://github.com/FullStackWithLawrence/aws-rekognition/commit/ef2ffb7ee6ad76205d95ea5d1e2e7bba9ef3ab3d))

## [0.2.9](https://github.com/FullStackWithLawrence/aws-rekognition/compare/v0.2.8...v0.2.9) (2023-12-22)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![hack.d Lawrence McDaniel](https://img.shields.io/badge/hack.d-Lawrence%20McDaniel-orange.svg)](https://lawrencemcdaniel.com)

A facial recognition microservice built with AWS Rekognition, DynamoDB, S3, API Gateway and Lambda.
A facial recognition microservice built with AWS Rekognition, DynamoDB, S3, IAM, CloudWatch, API Gateway and Lambda. See this [json dump](./doc/json/info_endpoint.json) for configuration options.

## Usage

Expand Down
34 changes: 23 additions & 11 deletions doc/json/info_endpoint.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"aws": {
"apigateway": {
"api_id": "287c8j8dcf",
"api_id": "287c9j8dcf",
"domains": [
{
"domainName": "api.rekognition.example.com",
"certificateArn": "arn:aws:acm:us-east-1:012345678901:certificate/613c0965-4495-4ce3-8e3e-63538eb40fd0",
"certificateUploadDate": "2023-12-13",
"distributionDomainName": "d1b9nzmXj7j3jr.cloudfront.net",
"distributionHostedZoneId": "ABCDEFG123HIJKL",
"distributionDomainName": "d1b9nzmfj7j3jr.cloudfront.net",
"distributionHostedZoneId": "Z2FDTNDATAQYW2",
"endpointConfiguration": {
"types": ["EDGE"]
},
"domainNameStatus": "AVAILABLE",
"securityPolicy": "TLS_1_2",
"tags": {
"contact": "YOUR CONTACT INFO HERE",
"contact": "YOUR CONTACT INFORMATION",
"project": "Facial Recognition microservice",
"shared_resource_identifier": "rekognition",
"terraform": "true"
Expand Down Expand Up @@ -172,9 +172,9 @@
},
"route53": {
"AliasTarget": {
"DNSName": "d1b9nzmXj7j3jr.cloudfront.net.",
"DNSName": "d1b9nzmfj7j3jr.cloudfront.net.",
"EvaluateTargetHealth": false,
"HostedZoneId": "ABCDEFG123HIJKL"
"HostedZoneId": "Z2FDTNDATAQYW2"
},
"Name": "api.rekognition.example.com.",
"Type": "A"
Expand All @@ -192,7 +192,7 @@
},
"aws_auth": {
"aws_access_key_id_source": "overridden by IAM role-based security",
"aws_profile": "default",
"aws_profile": "lawrence",
"aws_region": "us-east-1",
"aws_secret_access_key_source": "overridden by IAM role-based security"
},
Expand Down Expand Up @@ -324,7 +324,7 @@
"aws_account_id": "****",
"aws_apigateway_create_custom_domaim": true,
"aws_apigateway_root_domain": "example.com",
"aws_profile": "default",
"aws_profile": "lawrence",
"aws_region": "us-east-1",
"aws_rekognition_face_detect_attributes": "DEFAULT",
"aws_rekognition_face_detect_quality_filter": "AUTO",
Expand All @@ -342,16 +342,28 @@
"shared_resource_identifier": "rekognition",
"stage": "v1",
"tags": {
"contact": "YOUR CONTACT INFO HERE",
"contact": "YOUR CONTACT INFORMATION",
"project": "Facial Recognition microservice",
"shared_resource_identifier": "rekognition",
"terraform": "true"
},
"throttle_settings_burst_limit": 25,
"throttle_settings_rate_limit": 10
},
"version": "0.2.10"
"version": "0.2.11"
},
"services": [
"apigateway",
"aws-cli",
"cloudwatch",
"dynamodb",
"ec2",
"iam",
"lambda",
"rekognition",
"route53",
"s3"
],
"settings_defaults": {
"AWS_ACCESS_KEY_ID": "***MASKED***",
"AWS_APIGATEWAY_CONNECT_TIMEOUT": 70,
Expand All @@ -360,7 +372,7 @@
"AWS_APIGATEWAY_READ_TIMEOUT": 70,
"AWS_APIGATEWAY_ROOT_DOMAIN": "example.com",
"AWS_DYNAMODB_TABLE_ID": "rekognition",
"AWS_PROFILE": null,
"AWS_PROFILE": "lawrence",
"AWS_REGION": "us-east-1",
"AWS_REKOGNITION_COLLECTION_ID": "rekognition-collection",
"AWS_REKOGNITION_FACE_DETECT_ATTRIBUTES": "DEFAULT",
Expand Down
2 changes: 1 addition & 1 deletion terraform/python/rekognition_api/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# DO NOT EDIT.
# Managed via automated CI/CD in .github/workflows/semanticVersionBump.yml.
__version__ = "0.2.10-next.1"
__version__ = "0.2.11-next.1"
44 changes: 20 additions & 24 deletions terraform/python/rekognition_api/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import socket

# our stuff
from rekognition_api.conf import settings
from rekognition_api.conf import Services, settings
from rekognition_api.utils import recursive_sort_dict


Expand All @@ -16,32 +16,28 @@ class AWSInfrastructureConfig:
@property
def dump(self):
"""Return a dict of the AWS infrastructure config."""
api = self.get_api(settings.aws_apigateway_name)

retval = {
"apigateway": {
retval = {}
if Services.enabled(Services.AWS_APIGATEWAY):
api = self.get_api(settings.aws_apigateway_name)
retval["apigateway"] = {
"api_id": api.get("id"),
"stage": self.get_api_stage(),
"domains": self.get_api_custom_domains(),
},
"dynamodb": {
"table_name": self.get_dyanmodb_table_by_name(
settings.aws_dynamodb_table_id,
)
},
"s3": {
"bucket_name": self.get_bucket_by_prefix(settings.aws_s3_bucket_name),
},
"rekognition": {
"collection_id": self.get_rekognition_collection_by_id(settings.aws_rekognition_collection_id),
},
"iam": {
"policies": self.get_iam_policies(),
"roles": self.get_iam_roles(),
},
"lambda": self.get_lambdas(),
"route53": self.get_dns_record_from_hosted_zone(),
}
}
if Services.enabled(Services.AWS_S3):
retval["s3"] = {"bucket_name": self.get_bucket_by_prefix(settings.aws_s3_bucket_name)}
if Services.enabled(Services.AWS_DYNAMODB):
retval["dynamodb"] = {"table_name": self.get_dyanmodb_table_by_name(settings.aws_dynamodb_table_id)}
if Services.enabled(Services.AWS_REKOGNITION):
retval["rekognition"] = {
"collection_id": self.get_rekognition_collection_by_id(settings.aws_rekognition_collection_id)
}
if Services.enabled(Services.AWS_IAM):
retval["iam"] = {"policies": self.get_iam_policies(), "roles": self.get_iam_roles()}
if Services.enabled(Services.AWS_LAMBDA):
retval["lambda"] = self.get_lambdas()
if Services.enabled(Services.AWS_ROUTE53):
retval["route53"] = self.get_dns_record_from_hosted_zone()
return recursive_sort_dict(retval)

def get_lambdas(self):
Expand Down
Loading

0 comments on commit 060e257

Please sign in to comment.