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-bucketin the regionus-west-1. - The health check endpoint
/healthwill 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_bucketboto3 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.
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)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_cloud_healthcheck_aws_s3bucket-0.1.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|