A library of Linux-native functions which use Cloudflare's API to speed up DNS onboarding and management. Create zones, set DNS records, and edit properties from your terminal or program.
- Copy "api.default.config" to "api.config"
- Add credentials from Cloudflare's API to "api.config" and save. Acquire from "https://dash.cloudflare.com/profile/api-tokens".
- Call the script with a function as the first argument. Examples:
./cfapi.sh onboard_zone "example.com"
./cfapi.sh delete_zone "example.com"
Specify a Cloudflare domain name here ("parent-example.com") to have any new domain ("child-example.com") utilize the same endpoint as the parent.
- A CNAME record pointing to the parent will be created on the new domain. This uses CNAME flattening via Cloudlfare so an 'A record' is never needed.
- A concatenated CNAME record will be created on the parent domain to represent the child domain ("child-examplecom"). This can be deleted if not needed.
Leave blank if not using a parent domain.
Type | Name | Content |
---|---|---|
CNAME | subdomain | parentdomain.com |