Table of Contents
How to Connect PeaSoup S3 to Cloudflare
Follow these steps to configure your Cloudflare account to use PeaSoup S3 as a storage solution. Since PeaSoup uses an S3-compatible API, it can be integrated with Cloudflare’s services for content delivery, caching, or using Workers to interact with the storage.
Prerequisites
- PeaSoup S3 Access: Make sure you have the following details:
- Access key
- Secret key
- Bucket name
- PeaSoup S3 endpoint URL https://s3.eu-west-1.peasoup.cloud
- Cloudflare Account with the appropriate services enabled, such as Workers or caching services.
Steps to Connect PeaSoup S3 to Cloudflare
- Log into Cloudflare Dashboard:
- Go to the Cloudflare Dashboard and log in using your Cloudflare account credentials.
- Configure Cloudflare Workers (Optional for Access):
- If you are using Cloudflare Workers to access PeaSoup S3 data, navigate to the Workers section in your Cloudflare dashboard.
- Create a new worker and use JavaScript code to interact with PeaSoup S3 via its API. You can set the
Access Key
,Secret Key
, andEndpoint
in your worker script to access the PeaSoup S3 bucket. - Here’s a sample worker code for accessing PeaSoup S3:async function handleRequest(request) { const s3Endpoint = ‘https://s3.pscloud.io’; // PeaSoup S3 endpoint const accessKey = ‘your-access-key’; const secretKey = ‘your-secret-key’; const bucketName = ‘your-bucket-name’; // Example logic to connect to PeaSoup S3 const response = await fetch(`${s3Endpoint}/${bucketName}`, { method: ‘GET’, headers: { ‘Authorization’: `Bearer ${accessKey}:${secretKey}` } }); return new Response(response.body, { status: response.status }); } addEventListener(‘fetch’, event => { event.respondWith(handleRequest(event.request)); });
- Configure Cloudflare Cache Settings:
- If you plan to serve content from PeaSoup S3 via Cloudflare’s CDN, navigate to the Caching section in the Cloudflare dashboard.
- Set caching rules that direct requests for assets from PeaSoup S3, using the bucket URL or subdomain configuration.
- For example, you can use Cloudflare’s page rules to cache assets from the PeaSoup S3 bucket:
- Go to Page Rules > Create Rule.
- Enter the PeaSoup S3 bucket URL (e.g.,
https://s3.eu-west-1.peasoup.cloud*
). - Set the rule to cache static content or customize cache-control headers for assets being delivered via PeaSoup S3.
- Use PeaSoup S3 with Cloudflare Load Balancing (Optional):
- If using Cloudflare’s load balancing, you can add PeaSoup S3 as an origin server.
- In the Load Balancing section, configure an origin pool and add PeaSoup S3 as one of the origin nodes. Use the PeaSoup S3 endpoint and credentials for authentication.
- Test the Integration:
- Once configured, run a test by accessing files from PeaSoup S3 through Cloudflare’s caching and delivery system.
- Ensure that the assets are being correctly served from PeaSoup S3 via Cloudflare and that caching settings are working as intended.
Notes
- Ensure that PeaSoup S3 is accessible over the internet and is properly configured to allow external access. You may need to verify network settings and firewall rules for proper communication.
- Cloudflare Workers and cache settings allow flexible integration with S3-compatible storage services, making it easy to integrate PeaSoup S3 for a variety of use cases like content delivery, storage, and more.