This package is designed to validate the operational status of Amazon S3 buckets within an AWS account. It provides comprehensive diagnostics on the accessibility and functionality of an S3 bucket by performing key operations, including Bucket Accessibility, Object Operations and Bucket Policy Validation.
Project description
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 regionus-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:
-
Bucket Accessibility: Uses the
head_bucket
boto3 API to check if the bucket exists and is accessible. -
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.
-
Bucket Policy Check: Ensures the bucket policy is accessible by attempting to retrieve it.
-
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fastapi_cloud_healthcheck_aws_s3bucket-0.1.1.tar.gz
.
File metadata
- Download URL: fastapi_cloud_healthcheck_aws_s3bucket-0.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b4dfedcff2f5203e94cab8e99a3b1dd92ef738f824cb33806b5678f41b17162 |
|
MD5 | fc3252ac7af97f4d7eab20adcc12c805 |
|
BLAKE2b-256 | cb7bf401df31e23a5cd32296b5a4cfaa0d1b68e3e2d255005fe600656aaa0fe0 |
File details
Details for the file fastapi_cloud_healthcheck_aws_s3bucket-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: fastapi_cloud_healthcheck_aws_s3bucket-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8695e5d044bdd1c07a695aa2384938741370e26a1ce345c6911c2ed7268a7a6 |
|
MD5 | 512e81024ddb9f33d2649f7c2910cf49 |
|
BLAKE2b-256 | fb7a97806c7677c21792111e5ba7fa32ff95fec2574fb2fe61de923a0c7a7a77 |