Skip to main content

AWS Python SDK wrapper for boto3 commonly used functions

Project description

AWS Python SDK

Simple wrapper for AWS boto3 SDK commonly used functions.

Features

  • 📦 S3 operations (read, write, copy, list, delete, signed URLs)
  • 🔐 SSM Parameter Store integration
  • ⚡ Lambda function invocation (async and sync)
  • 🚀 Optimized for AWS Lambda and serverless environments

Installation

pip install actvalue.aws-pysdk

Or with uv:

uv add actvalue.aws-pysdk

Configuration

Provide the following environment variables:

  • ENV: development | production | ...
  • AWSPROFILE: A named profile (non-default) in the credential file, e.g.: myprofile
  • AWSREGION: A region name, e.g.: eu-west-1

Note: AWSPROFILE and AWSREGION are needed in development only. Production uses the default session/client configuration.

Usage

S3 Operations

from aws_pysdk import s3_write, s3_read, s3_read_to_string, s3_get_signed_url
import os

# Write to S3
s3_write('my-bucket', 'hello.txt', 'Hello World', 'text/plain')

# Read from S3
response = s3_read('my-bucket', 'hello.txt')
content = response['Body'].read()

# Read directly to string
content_str = s3_read_to_string('my-bucket', 'hello.txt')

# Get signed URL for reading
read_url = s3_get_signed_url(
    {'Bucket': 'my-bucket', 'Key': 'file.txt'},
    'READ',
    3600  # expires in 1 hour
)

# Get signed URL for writing
write_url = s3_get_signed_url(
    {'Bucket': 'my-bucket', 'Key': 'file.txt', 'ContentType': 'text/plain'},
    'WRITE',
    3600
)

SSM Parameter Store

from aws_pysdk import ssm_load_parameters
import os

# Define parameters to load
params = [
    {'name': '/app/bucket/name', 'env_var_name': 'MY_BUCKET', 'decrypt': False},
    {'name': '/app/api/key', 'env_var_name': 'API_KEY', 'decrypt': True},
]

# Load parameters into environment variables
ssm_load_parameters(params)

# Access loaded parameters
my_bucket = os.environ['MY_BUCKET']
api_key = os.environ['API_KEY']

Lambda Function Invocation

from aws_pysdk import lambda_invoke, lambda_invoke_with_response

# Asynchronous invocation (fire and forget)
lambda_invoke('my-function', {'key': 'value'})

# Synchronous invocation (wait for response)
result = lambda_invoke_with_response('my-function', {'key': 'value'})
print(result)  # Parsed JSON response

# Invoke with ARN
lambda_invoke_with_response(
    'arn:aws:lambda:region:account:function:my-function',
    {'data': 'payload'}
)

Development

Prerequisites

  • Python 3.11+
  • uv (recommended) or pip

Setup with uv (recommended)

# Install dependencies
make install

# Run tests
make test

# Format code
make format

# Lint code
make lint

# Build package
make build

Available Make Commands

make help           # Show all available commands
make install        # Install dependencies with uv
make test           # Run tests with pytest
make lint           # Lint code with ruff
make format         # Format code with ruff
make build          # Build package with uv
make publish        # Publish to PyPI
make publish-test   # Publish to Test PyPI
make clean          # Clean build artifacts
make venv           # Show virtual environment location

Manual Setup

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install package in development mode
pip install -e ".[dev]"

# Run tests
pytest

Publishing

To Test PyPI

make publish-test

To Production PyPI

make publish

License

MIT

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

actvalue_aws_pysdk-1.0.1.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

actvalue_aws_pysdk-1.0.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file actvalue_aws_pysdk-1.0.1.tar.gz.

File metadata

  • Download URL: actvalue_aws_pysdk-1.0.1.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for actvalue_aws_pysdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 716cb32547f277213dbbd7916d272c2349274a7c88d3ac07b83460d0e2bbbd65
MD5 bcd1e08bcf7c622c63bb95ecb0069adc
BLAKE2b-256 040fab7a7f3d1e6f9f8b52d4317e6e387ec3b382002af726c07e6a2234404903

See more details on using hashes here.

File details

Details for the file actvalue_aws_pysdk-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for actvalue_aws_pysdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae4709a7b48ff53bddffe7465f7dc84d6e8db9da0236d8f716f2af9b03b1f82b
MD5 690d4621b8d7a852d31626ff4a18b1bb
BLAKE2b-256 587965e2cccfa013e5ac08c6a6b4418e212531aad402d4ff7dcbcbc5f34f6170

See more details on using hashes here.

Supported by

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