An application key defines the operations an integration can perform. The master application key has broad account access and should not be embedded in an application. Standard application keys can be restricted and independently deleted, making them safer for individual services and environments.
Before You Begin
- A Backblaze account with permission to manage application keys.
- A specific application, bucket, and file-prefix requirement.
- A secure server-side secret store.
Recommended Approach
1. Define the application scope
Decide which bucket and file prefix the application needs. Separate production, staging, backup, and customer-specific integrations when their access needs differ.
2. Create a standard application key
In the B2 console, open Application Keys and create a new key. Give it a clear purpose-based name and select only the required bucket or buckets.
3. Select capabilities
Grant read-only, write-only, or read/write capabilities as appropriate. Add listing, deleting, or sharing capabilities only when the application uses those operations. Restrict by filename prefix if the application owns only part of a bucket.
4. Set expiration and store securely
Use an expiration when practical. Copy the application key secret when it is displayed and store it in a secrets manager; it may not be shown again. Never put it in a browser bundle or public repository.
5. Rotate and revoke
Create a replacement key, deploy it, verify the integration, and then delete the old key. If a key is exposed, revoke it and review access logs and affected objects.
Operational Considerations
Cloud storage and compute designs should account for security, availability, lifecycle, and cost together. Decide where data resides, how long it is retained, which identities can reach it, and how the service behaves during a regional or credential failure. Separate production and test resources when their access needs differ. Review data-transfer charges, request volume, version retention, and abandoned multipart uploads as part of routine operations.
How to Verify the Result
Test the workflow using the same role and network path that the deployed application will use. Verify successful access to the intended object or service, denial for an unrelated object, and behavior after a temporary credential expires. Check logs for the principal and operation, and confirm that lifecycle, versioning, and backup settings match the data-retention policy.
Example Configuration
Illustrative example — adapt values to your environment
# Operational separation
production-upload-key: writeFiles, restricted bucket, uploads/ prefix
production-download-key: readFiles, restricted bucket, customer-files/ prefix
# Store the actual secrets outside source code.
Common Mistakes to Avoid
- Never use the master key for a routine web application.
- A key that can list buckets or delete files may have a much greater impact than a simple upload key.
- Do not assume a key is restricted to a bucket unless the console/API settings confirm that scope.
Make one change at a time, test it from the perspective of the actual user or application, and record the reason for the change. Keep a rollback path for network, identity, and production configuration changes.
Final Checklist
- The configuration matches the intended environment and service version.
- Access is limited to the required identities, resources, ports, and operations.
- The expected workflow has been tested, including a negative test for unauthorized access.
- Secrets and temporary credentials are protected and excluded from logs and source control.
- The configuration owner, purpose, and review or expiration date are documented.