Skip to main content

##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

Metadata

Release files for aws-client-wrapper 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-client-wrapper 1.0.4
File Size Uploaded
aws_client_wrapper-1.0.4.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-client-wrapper 1.0.4
File Interpreter ABI Platform
aws_client_wrapper-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / aws_client_wrapper-1.0.4.tar.gz

Download URL aws_client_wrapper-1.0.4.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7f73710f76849dc6abd1a5b0c22fc82d1ad4e6e9250e0e87ecc375c83e632d7b
BLAKE2b-256 checksum
How to use checksums
fcd959280c6521ab414e4eb19fc78f8e466586d10e0b675d1aa6830b07492b7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.0 Windows/10

Release files / aws_client_wrapper-1.0.4-py3-none-any.whl

Download URL aws_client_wrapper-1.0.4-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
595de97665c23e9a770abdcdac9d22c0b7b9367df5901bef3e896424005879f7
BLAKE2b-256 checksum
How to use checksums
8f6939221361d9fb2648f2fe9f804a95fd4a6472d4640e0180d78bccabd32f31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.0 Windows/10

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page