Skip to main content

A versatile Python library for seamless access to Amazon S3 and CloudFront using ARN role-based authorization. This wrapper, built atop Boto3, enables easy integration with Python 3.11 and facilitates AWS resource access from within Google Cloud Platform environments.

Project description

##AWS Client Wrapper

Overview

aws-client-wrapper is a Python library designed to simplify role-based interactions with Amazon Web Services (AWS) resources using ARN. This library is designed to provide role-based access for AWS resources from GCP serverless services like Cloud-Run and GAE. It provides a convenient wrapper around AWS SDK functionalities, focusing on operations related to AWS S3 buckets and AWS CloudFront.

Features

Support for AWS S3 bucket operations and AWS CloudFront cache operations. Role-based access to AWS resources using ARN. Compatibility with WebApp2 Gunicorn apps. Internal use of Redis cache to reduce fetching AWS temporary credentials repeatedly. Temporary credentials are stored in the Redis cache for 3500 minutes. Ability to insert API call operation stats into logs by passing a stats function name along with project_id, dataset_id, and table_id during configuration.

Required ENV variable for working with aws resource

  1. Simplify AWS Role Access with Environment Variables

To streamline access to AWS services, set up your AWS Role ARN as an environment variable. It's crucial to name the key AWS_ROLE_ARN for the application to function correctly. This step ensures seamless authentication and authorization processes, enhancing the security and efficiency of your AWS interactions.

  1. Boost Performance with Redis Cache Integration

For enhanced performance and reliability, consider enabling the Redis cache feature. By setting the REDIS_HOST as an environment variable, you can effortlessly leverage Redis caching capabilities within your application. While this step is optional, it significantly improves data retrieval speed and overall system responsiveness. Remember to name the key REDISHOST for seamless integration.

  1. Facilitate Cross-Cloud Communication

To maximize the flexibility and capabilities of your application, enable communication between your Google Cloud Platform (GCP) services and AWS. This integration allows your GCP services to seamlessly interact with AWS resources, enabling a unified and efficient cloud environment. Leveraging this interoperability unlocks a myriad of possibilities, empowering your application with enhanced functionality and scalability.

Installation

You can install aws-client-wrapper via pip:

pip install aws-client-wrapper

Usage

Configuration

Configure aws-client-wrapper in your application initialization file:

from aws_client_wrapper import configure
configure(
    aws_stats_func=None, 
    aws_stats_project_id=None,
    aws_stats_dataset_id=None, 
    aws_stats_table_id=None
)

Example Usage

# Importing AWS S3 and CloudFront clients

from aws_client_wrapper import s3_client, cloud_front

# Example usage of AWS S3 client functions
s3_client.get_data_from_s3(bucket_name=None, key=None)
s3_client.get_keys_object_by_prefix_from_s3(bucket_name=None, key=None)
s3_client.check_key_exist_from_s3(bucket_name=None, key=None)
s3_client.upload_data_to_s3(bucket_name=None, key=None, data=None, content_type=None,
                          acl=None, CacheControl=None)
s3_client.delete_data_from_s3(bucket_name=None, key=None)

# Example usage of AWS CloudFront client functions
cloud_front.invalidate_cloudfront(aws_distribution_id=None, invalidation_paths=None)
cloud_front.get_invalidation_status(aws_distribution_id=None, invalidation_id=None)

Response Format

The response format of each function will be in JSON format:

{
    "data": "string"|"dict"|"list"| None,
    "status_code": 200,
    "error_message": ""
}

Support For any queries or issues, please Contact Us

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_client_wrapper-1.0.4.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

aws_client_wrapper-1.0.4-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file aws_client_wrapper-1.0.4.tar.gz.

File metadata

  • Download URL: aws_client_wrapper-1.0.4.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.0 Windows/10

File hashes

Hashes for aws_client_wrapper-1.0.4.tar.gz
Algorithm Hash digest
SHA256 7f73710f76849dc6abd1a5b0c22fc82d1ad4e6e9250e0e87ecc375c83e632d7b
MD5 94e23ba2a803ede04ed5a39153f8fc2a
BLAKE2b-256 fcd959280c6521ab414e4eb19fc78f8e466586d10e0b675d1aa6830b07492b7f

See more details on using hashes here.

File details

Details for the file aws_client_wrapper-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_client_wrapper-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 595de97665c23e9a770abdcdac9d22c0b7b9367df5901bef3e896424005879f7
MD5 6c90b92cb557e9da29cf34e8aeed51a4
BLAKE2b-256 8f6939221361d9fb2648f2fe9f804a95fd4a6472d4640e0180d78bccabd32f31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page