Uploading to Your S3 Bucket
PDFBolt offers the option to upload generated PDFs directly to your own S3-compatible storage, providing enhanced security and compliance, especially with GDPR requirements. By utilizing this feature, you ensure that your documents are stored in your own environment, and you have full control over them.
Advantages of Uploading to Your S3 Bucket
-
Enhanced Security: By storing PDFs in your own S3 bucket, you reduce the risk associated with transferring files over networks and relying on third-party storage.
-
GDPR Compliance: Direct uploads to your storage mean that PDFBolt doesn't store your documents longer than necessary, aligning with GDPR's data minimization principles.
-
Control Over Data: You have full control over access permissions, storage duration, and data handling policies for your documents.
How It Works
1. Generate a Pre-Signed URL: Create a pre-signed URL that allows PDFBolt to upload the PDF directly to your S3 bucket without needing your storage credentials.
2. Include customS3PresignedUrl
in Your Request: When making a request to the PDFBolt API, include the customS3PresignedUrl
parameter with the generated pre-signed URL.
3. PDFBolt Uploads to Your Bucket: Once the PDF is generated, PDFBolt uses the pre-signed URL to upload the document directly to your S3 bucket.
4. Access Your PDF: You can then access the PDF from your own S3 bucket, following your usual procedures.
Supported S3-Compatible Storage
PDFBolt supports any S3-compatible storage, not just AWS S3. This means you can use services like:
- Amazon S3
- DigitalOcean Spaces
- MinIO
- Wasabi
- Backblaze B2
Example: Generating a Pre-Signed URL in Node.js
Here's how you can generate a pre-signed URL in Node.js using the AWS SDK:
const AWS = require('aws-sdk');
// Configure AWS with your access and secret key.
AWS.config.update({
accessKeyId: 'YOUR_ACCESS_KEY',
secretAccessKey: 'YOUR_SECRET_KEY',
region: 'YOUR_BUCKET_REGION'
});
const s3 = new AWS.S3();
const params = {
Bucket: 'your-bucket-name',
Key: 'path/to/your-document.pdf',
Expires: 300 // URL expires in 5 minutes
};
const presignedUrl = s3.getSignedUrl('putObject', params);
- Ensure the pre-signed URL is valid and correctly configured to accept uploads.
Using the Pre-Signed URL with PDFBolt
Include the customS3PresignedUrl
in your request to the PDFBolt API:
{
"url": "https://example.com",
"customS3PresignedUrl": "https://your-bucket.s3.amazonaws.com/path/to/your-document.pdf?AWSAccessKeyId=YOUR_ACCESS_KEY&Expires=1609459200&Signature=YOUR_SIGNATURE"
}
- Permissions: Ensure that the IAM user or role you use to generate the pre-signed URL has the necessary permissions to perform the
putObject
operation on the specified bucket and key. - Expiration: Set an appropriate expiration time for the pre-signed URL, such as 5 minutes, which should be sufficient for the PDF generation and upload process.
For more details on how to generate pre-signed URLs in other languages, refer to the AWS SDK documentation or your storage provider's SDK.