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.

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

AWSPROFILE and AWSREGION are needed in development only, production uses the default session / client configuration.

Installation

pip install actvalue.aws-pysdk

Usage

from aws_pysdk import s3_write, s3_read, ssm_load_parameters

# Get Bucket name from ssm parameters
params = [
        {'name': '/app/bucket/name', 'env_var_name': 'MY_BUCKET', 'decrypt': False},
        ]
# Load parameters into environment variables
ssm_load_parameters(params)
# Now you can access it via os.environ
my_bucket = os.environ['MY_BUCKET']

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

# Get Signed url
params = {
    'Bucket': my_bucket,
    'Key': 'my-file.txt',
    'ContentType': 'text/plain'  # optional
}

# Get a read URL
read_url = s3_get_signed_url(params, 'READ', 3600)  # expires in 1 hour

# Get a write URL
write_url = s3_get_signed_url(params, 'WRITE', 3600)

Develpment and test

Create and activate virtual environment

python -m venv .venv
.\.venv\Scripts\activate

Install package in development mode

pip install -e .

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-0.3.0.tar.gz (6.1 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-0.3.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: actvalue_aws_pysdk-0.3.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for actvalue_aws_pysdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0fc79f5a3807d932aa9aa7c5de48a35fdec46654dac33c9a186142853f05c80d
MD5 b19705cb898a1ba62757e47a49901d2a
BLAKE2b-256 a73dbd9169fe505aaa3d84938a6540273fbcd1613db8006e9f29eb0e9d985098

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for actvalue_aws_pysdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb54fcf24df009e8bbd1ef96fe03ef37aa028fe5a65876904094ceb5feefef61
MD5 a9f37af2c87da1cb64078b26af5311ff
BLAKE2b-256 021897f810d79e6441674592d73f9e0d637b1d90d33981e834d5f0f76e67dc67

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