Skip to main content

fastapi_cloud_healthcheck_aws_s3bucket

A FastAPI-based health check module for monitoring the health of AWS S3 buckets using the fastapi_cloud_healthcheck package.

Features

  • Bucket Accessibility: Verifies if the S3 bucket exists and is accessible within the given AWS region.
  • Object Operations: Performs test operations such as uploading, reading, and deleting objects within the bucket to ensure correct permissions.
  • Bucket Policy Validation: Checks for the presence of an S3 bucket policy and its retrieval status.
  • Automated Account Detection: Automatically retrieves the AWS Account ID for the health check metadata.

Adding Health Checks

Here is a sample FastAPI application that integrates the S3 bucket health check:

from fastapi import FastAPI
from fastapi_cloud_healthcheck import HealthCheckFactory, create_health_check_route
from fastapi_cloud_healthcheck_aws_s3bucket import HealthCheckS3Bucket

app = FastAPI()

# Create Health Check Factory
health_check_factory = HealthCheckFactory()

# Add the S3 Bucket Health Check
health_check_factory.add(
    HealthCheckS3Bucket(
        bucket_name="my-sample-bucket",
        region="us-west-1"
    )
)

# Add the health check route to FastAPI
app.add_api_route('/health', endpoint=create_health_check_route(factory=health_check_factory))

In the above example:

  • We create a health check for the S3 bucket named my-sample-bucket in the region us-west-1.
  • The health check endpoint /health will expose detailed health information about the S3 bucket.

Health Check Process

The S3 Bucket Health Check performs the following operations:

  1. Bucket Accessibility: Uses the head_bucket boto3 API to check if the bucket exists and is accessible.

  2. Test Object Operations:

    • Upload: Uploads a temporary object to the bucket.
    • Read: Retrieves and validates the content of the test object.
    • Cleanup: Deletes the test object after validation.
  3. Bucket Policy Check: Ensures the bucket policy is accessible by attempting to retrieve it.

  4. MultiPart Object Upload:

    • Initiation: Starts a multipart upload for a test object.
    • Abortion: Immediately aborts the multipart upload to verify that the multipart upload feature is functional.

Metadata

Release files for fastapi-cloud-healthcheck-aws-s3bucket 0.1.1

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

Source distribution (sdist)

Source distribution for fastapi-cloud-healthcheck-aws-s3bucket 0.1.1
File Size Uploaded
fastapi_cloud_healthcheck_aws_s3bucket-0.1.1.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-cloud-healthcheck-aws-s3bucket 0.1.1
File Interpreter ABI Platform
fastapi_cloud_healthcheck_aws_s3bucket-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / fastapi_cloud_healthcheck_aws_s3bucket-0.1.1.tar.gz

Download URL fastapi_cloud_healthcheck_aws_s3bucket-0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b4dfedcff2f5203e94cab8e99a3b1dd92ef738f824cb33806b5678f41b17162
BLAKE2b-256 checksum
How to use checksums
cb7bf401df31e23a5cd32296b5a4cfaa0d1b68e3e2d255005fe600656aaa0fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1014-azure

Release files / fastapi_cloud_healthcheck_aws_s3bucket-0.1.1-py3-none-any.whl

Download URL fastapi_cloud_healthcheck_aws_s3bucket-0.1.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8695e5d044bdd1c07a695aa2384938741370e26a1ce345c6911c2ed7268a7a6
BLAKE2b-256 checksum
How to use checksums
fb7a97806c7677c21792111e5ba7fa32ff95fec2574fb2fe61de923a0c7a7a77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1014-azure

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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