Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abdullahkhawer/vizion-api-python-integration-for-aws
Vizion API Integration in Python using Flask for AWS using AWS Lambda and AWS API Gateway which can be deployed using Serverless Framework.
https://github.com/abdullahkhawer/vizion-api-python-integration-for-aws
amazon-web-services aws aws-api-gateway aws-lambda aws-s3 boto3 flask python python3-7 rest-api serverless vizion vizion-api
Last synced: 10 days ago
JSON representation
Vizion API Integration in Python using Flask for AWS using AWS Lambda and AWS API Gateway which can be deployed using Serverless Framework.
- Host: GitHub
- URL: https://github.com/abdullahkhawer/vizion-api-python-integration-for-aws
- Owner: abdullahkhawer
- License: apache-2.0
- Created: 2020-09-28T16:36:53.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-05T18:43:18.000Z (5 months ago)
- Last Synced: 2024-10-12T22:09:44.896Z (25 days ago)
- Topics: amazon-web-services, aws, aws-api-gateway, aws-lambda, aws-s3, boto3, flask, python, python3-7, rest-api, serverless, vizion, vizion-api
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vizion API Integration for AWS
- Founder: Abdullah Khawer (LinkedIn: https://www.linkedin.com/in/abdullah-khawer/)
- Version: v1.0## Introduction
Vizion API Integration in Python using Flask for AWS using AWS Lambda and AWS API Gateway which can be deployed using Serverless Framework.
AWS Lambda function is using Python 3.7 as its runtime environment.
### Any contributions, improvements and suggestions will be highly appreciated.
## Components Used
Following are the components used in this framework:
- Python script having the main logic developed in Python 3.7.
- Boto3 for AWS resources access in Python.
- Flask for API development in Python.
- Requests for HTTP/HTTPS requests handing to the Vizion API and Slack in Python.
- Serverless Framework template in YAML for stack deployment.
- AWS CloudWatch log group for execution logs by AWS Lambda function.
- AWS Lambda function to execute the main Python script.
- AWS IAM role used by the Lambda function with least privileges including AWS S3 write permissions on the desired S3 bucket.
- AWS API Gateway for API building and management.
- AWS Lambda Invoke Permission for AWS API Gateway.## List of Environment Variables
- ENVIRONMENT *(Name of Environment e.g., staging)*
- AWS_REGION *(ID of AWS Region e.g., us-east-1)*
- AWS_LAMBDA_IAM_ROLE_ARN *(ARN of AWS Lambda IAM Role e.g., arn:aws:iam::xxxxxxxxxxxx:role/vizion-api-lambda-role)*
- VIZION_API_HOST *(Vizion API Host e.g., https://demo.vizionapi.com)*
- VIZION_API_KEY *(API Key Provided by the Vizion API)*
- VIZION_API_DATA_S3_BUCKET *(Name of AWS S3 Bucket e.g., my-bucket-12345)*
- (Optional) PAPERTRAIL_HOST *(Papertrail Host e.g., xxxx.papertrailapp.com)*
- (Optional) PAPERTRAIL_PORT *(Papertrail Port e.g., 12345)*
- (Optional) SLACK_WEBHOOK_URL *(Slack Webhook URL e.g., https://hooks.slack.com/services/XXXXX/XXXXX/XXXXXXXXXX)*
- (Optional) SLACK_INFO_CHANNEL *(Slack Info Channel Name e.g., #dummy)*
- (Optional) SLACK_ERROR_CHANNEL *(Slack Info Channel Name e.g., #dummy)*## Local Deployment Instructions
Pre-requisites:
- Python >= v3.0
- Node >= v10.0.0
- AWS CLI with Credentials Configured having Write Permissions.
- Values for the environment variables mentioned above are set.
- AWS IAM Role for AWS Lambda with Lambda Basic Execution Permissions and AWS S3 Write Permissions for the desired S3 Bucket.Commands:
- `bash deploy.sh`
- `python api.py`## Serverless Deployment on AWS Instructions
Pre-requisites:
- Python >= v3.0
- Node >= v10.0.0
- AWS CLI with Credentials Configured having Write Permissions.
- Serverless >= v1.79.0
- Values for the environment variables mentioned above are set.
- AWS IAM Role for AWS Lambda with Lambda Basic Execution Permissions and S3 Write Permissions for the desired S3 Bucket.Commands:
- `bash deploy.sh`
- `sls deploy`## Integrated Vizion APIs
Below will be the links of the 6 Vizion APIs that are integrated on AWS which can be accessed over the Internet using a tool like Postman without authentication:
- **METHOD: NAME - URL**
- POST: **Add Container Reference** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/add-container-reference
- Sample Example:
{
"container_id": "TLLU5502800",
"scac": "ONEY",
"callback_url": "https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/get-reference-updates-via-callback/"
}
- GET: **Get Reference Info** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/get-reference-info/[UUID]
- GET: **Get Reference Updates** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/get-reference-updates/[UUID]
- POST: **Get Reference Updates via Callback (For Use by Vizion API Only)** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/get-reference-updates-via-callback/
- DELETE: **Unsubscribe From Reference** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/unsubscribe-from-reference/[UUID]
- GET: **List All Active References** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/list-all-active-references
- GET: **List All Available Carriers** - https://[RESOURCE-ID].execute-api.[REGION].amazonaws.com/staging/list-all-available-carriers*Note: Don't forget to replace [RESOURCE-ID], [REGION], and/or [UUID] in the above URLs.*
### Warning: You will be billed for the AWS resources used if you create a stack for this solution.