Connect Cloudflare Account
Connect your Cloudflare account to OEC.sh for industry-leading DNS management and cost-effective R2 object storage.
What You'll Get
After connecting your Cloudflare account, OEC.sh can:
| Capability | What It Enables |
|---|---|
| Storage | Use Cloudflare R2 (S3-compatible) for backups with zero egress fees |
| DNS | Manage DNS records with Cloudflare's global network |
Note: Cloudflare doesn't provide compute services. Use another provider for servers.
Prerequisites
Before you begin, ensure you have:
- Active Cloudflare account (Sign up here (opens in a new tab))
- At least one domain added to Cloudflare (for DNS)
- R2 subscription enabled (for storage) - free tier available
Why Cloudflare R2?
Cloudflare R2 is S3-compatible object storage with a game-changing pricing model:
| Feature | Cloudflare R2 | AWS S3 |
|---|---|---|
| Egress fees | $0 (forever free) | $0.09/GB |
| Storage | $0.015/GB/month | $0.023/GB/month |
| API operations | 10M free, then $4.50/M | $0.005/1000 requests |
Perfect for backups because you don't pay to download your own data!
Step-by-Step Connection
Step 1: Access Cloudflare Dashboard
- Go to dash.cloudflare.com (opens in a new tab)
- Sign in to your account
Step 2: Get Your Account ID
- Click on any domain in your account (or go to Manage Account > Account Home)
- Scroll down to find your Account ID on the right sidebar
- Copy the Account ID (it looks like:
1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p)
Step 3: Create API Token
- Click your profile icon (top right)
- Click My Profile
- Click API Tokens in the left sidebar
- Click Create Token
Option A: Use Template (Recommended)
- Find Edit zone DNS template and click Use template
- Modify permissions to add R2:
| Permission | Access |
|---|---|
| Zone - DNS | Edit |
| Account - Cloudflare R2 Storage | Edit |
-
Under Zone Resources, select:
- Include → All zones (or specific zones)
-
Click Continue to summary → Create Token
Option B: Custom Token
- Click Create Custom Token
- Give it a name:
OEC.sh Integration - Add permissions:
| Scope | Permission | Access |
|---|---|---|
| Account | Cloudflare R2 Storage | Edit |
| Zone | DNS | Edit |
-
Configure resources:
- Account Resources: Include → Your account
- Zone Resources: Include → All zones (or specific)
-
Click Continue to summary → Create Token
Step 4: Copy Your Token
IMPORTANT: Copy the token immediately - it's only shown once!
The token looks like: Kq8HNwl3fMoT2c7JzP9xL6dR4yE1wB5sH8mG0vF
Step 5: Add to OEC.sh
- Go to app.oec.sh (opens in a new tab) > Settings > Cloud Accounts
- Click Add Account
- Under API Key Authentication, click Cloudflare
- Fill in the form:
| Field | Value |
|---|---|
| Account Name | Cloudflare Production (or your preferred name) |
| API Token | Paste your Cloudflare API token |
| Account ID | Paste your Cloudflare Account ID |
- Click Add Account
Step 6: Verify Connection
- Your Cloudflare account should appear in the list
- Status should show Active (green badge)
- Click the refresh icon to validate
- You should see: Storage, DNS capability badges
Using Your Cloudflare Account
For Backup Storage (R2)
- Go to Settings > Storage
- Click Quick Setup on your Cloudflare account
- Select or create an R2 bucket
- Configure backup settings
Create R2 Bucket (if needed)
- Go to Cloudflare Dashboard > R2
- Click Create bucket
- Name it (e.g.,
oec-backups) - Select location hint (closest to your servers)
- Click Create bucket
For DNS Management
- Go to Settings > DNS Providers
- Click Quick Setup on your Cloudflare account
- Select a domain from your Cloudflare zones
- OEC.sh will manage A records automatically
Note: Cloudflare provides automatic DDoS protection and CDN on all DNS-managed domains.
R2 Location Hints
When creating R2 buckets, you can specify a location hint for optimal performance:
| Hint | Region |
|---|---|
wnam | Western North America |
enam | Eastern North America |
weur | Western Europe |
eeur | Eastern Europe |
apac | Asia Pacific |
Note: R2 is automatically replicated globally. Location hint optimizes for primary access location.
API Token Permissions Explained
Minimum Required
| Scope | Permission | Purpose |
|---|---|---|
| Account - R2 Storage | Edit | Create/manage buckets, upload backups |
| Zone - DNS | Edit | Create/update DNS records |
Optional Enhancements
| Scope | Permission | Purpose |
|---|---|---|
| Zone - SSL/TLS | Read | View certificate status |
| Zone - Page Rules | Edit | Configure caching rules |
| Zone - Cache | Purge | Clear CDN cache |
Managing Your Connection
Rotate API Token
For security, rotate your token periodically:
- Create a new API token in Cloudflare
- Update OEC.sh with the new token
- Delete the old token in Cloudflare
- Recommended: Every 90 days
Verify Token Permissions
- Go to Cloudflare > My Profile > API Tokens
- Click the token to view its permissions
- Ensure R2 and DNS Edit permissions are present
Delete Account
- In OEC.sh, click Delete on the account
- Optionally, revoke the API token in Cloudflare
Troubleshooting
"Invalid API Token" Error
Cause: Token is incorrect or revoked.
Solution:
- Verify the token in Cloudflare > API Tokens
- Ensure token hasn't expired (check expiry setting)
- Create a new token if needed
"Invalid Account ID" Error
Cause: Account ID is incorrect or doesn't match the token.
Solution:
- Find Account ID in Cloudflare Dashboard sidebar
- Ensure it's the Account ID (not Zone ID)
- Account ID is 32 characters
R2 Operations Fail
Cause: Token lacks R2 permissions.
Solution:
- Check token has Cloudflare R2 Storage: Edit permission
- Ensure R2 is enabled on your account:
- Go to Cloudflare Dashboard > R2
- Complete setup if prompted
- Create a new token with correct permissions
"Zone Not Found" Error
Cause: Token doesn't have access to the zone.
Solution:
- Verify zone is added to Cloudflare
- Check token's Zone Resources:
- Should include the specific zone or "All zones"
- Ensure zone is active (not pending)
DNS Records Not Updating
Cause: Zone in pending state or nameservers not updated.
Solution:
- Check zone status in Cloudflare Dashboard
- Ensure nameservers are updated at registrar:
- Check for assigned Cloudflare nameservers (e.g.,
ada.ns.cloudflare.com)
- Check for assigned Cloudflare nameservers (e.g.,
- Wait for DNS propagation (up to 48 hours for new domains)
Best Practices
DNS Configuration
- Proxy Status: Use proxied (orange cloud) for web traffic
- SSL Mode: Set to Full (Strict) for end-to-end encryption
- DNSSEC: Enable for additional security
R2 Configuration
- Public Access: Keep buckets private for backups
- Lifecycle Rules: Set up auto-deletion for old backups
- Bucket Naming: Use descriptive names (e.g.,
oec-backups-prod)
Security
- Token Scope: Only grant necessary permissions
- IP Restrictions: Optional - limit token to OEC.sh IPs
- Audit Log: Review access in Cloudflare Audit Log
Cost Considerations
Cloudflare R2 pricing:
| Component | Cost |
|---|---|
| Storage | $0.015/GB/month |
| Class A Operations (write) | Free first 1M, then $4.50/M |
| Class B Operations (read) | Free first 10M, then $0.36/M |
| Egress | Always $0 |
Cloudflare DNS is included free with your account.
Monthly Cost Example
For 100GB of backups with typical operations:
- Storage: 100GB × 1.50/month**
- Operations: Usually covered by free tier
- Egress: $0
Compare to AWS S3:
- Storage: 100GB × 2.30
- Egress (50GB restore): 50GB × 4.50**
Cloudflare + Other Providers
Cloudflare works great alongside compute providers:
| Setup | Use Case |
|---|---|
| Cloudflare DNS + Hetzner | Cost-effective European hosting |
| Cloudflare DNS + DigitalOcean | Simple cloud with great DNS |
| Cloudflare R2 + Any Provider | Zero-egress backup storage |
Recommended Architecture
- Compute: DigitalOcean, Vultr, or Hetzner
- DNS: Cloudflare (free tier)
- Backups: Cloudflare R2 (no egress fees)