Integrating Fastly with Adobe Commerce requires two critical credentials: the API Token and Service ID. These credentials enable you to manage caching and CDN configurations effectively. This blog outlines the steps to retrieve these credentials, whether you’re using an Adobe Commerce Pro or Starter project.
Why API Token and Service ID Are Important
The API Token authenticates your Adobe Commerce store with Fastly, while the Service ID identifies your specific Fastly service configuration. These credentials are required for integrating Fastly’s advanced caching and delivery features.
Let’s Retrieve Fastly API Token and Service ID
Retrieving Credentials for Adobe Commerce Pro Projects
For Pro projects hosted on Adobe Commerce Cloud, you can locate the Fastly credentials directly on the server.
Connect to the Server:
- Connect to the Server:
- Use SSH to access the server where your Adobe Commerce instance is hosted.
- Use SSH to access the server where your Adobe Commerce instance is hosted.
- Navigate to the Shared Directory:
- Switch to the shared directory by running
cd /mnt/shared/
- Switch to the shared directory by running
- Locate the Fastly Tokens File:
- Search for the
fastly_tokens.txt
file in this directory.
- Search for the
- View the Credentials:
- cat fastly_tokens.txt
Retrieving Credentials for Adobe Commerce Starter Projects
For Starter projects, the credentials are stored as environment variables accessible via the Magento Cloud CLI.
- Access Environment Variables:
- Run the following command to list all environment variables:bash
Copy codemagento-cloud variable:get -e <environment-ID>
- Replace
<environment-ID>
with the specific identifier for your environment (e.g.,staging
,production
).
- Run the following command to list all environment variables:bash
- Locate Fastly Variables:
- Look for these environment variables:
CONFIG__DEFAULT__SYSTEM__FULL_PAGE_CACHE__FASTLY__FASTLY_API_KEY
CONFIG__DEFAULT__SYSTEM__FULL_PAGE_CACHE__FASTLY__FASTLY_SERVICE_ID
- Look for these environment variables:
- Retrieve the Values:
- The values of these variables correspond to the API Token and Service ID.
- The values of these variables correspond to the API Token and Service ID.
Alternative Method: Using the Adobe Commerce Cloud Console
For both Pro and Starter projects, you can also retrieve Fastly credentials from the Adobe Commerce Cloud Console.
- Log in to the Console:
- Access your Adobe Commerce Cloud account and navigate to the specific project environment (e.g., staging, production).
- Access your Adobe Commerce Cloud account and navigate to the specific project environment (e.g., staging, production).
- Access Environment Configuration:
- Search for the same variables mentioned above:
CONFIG__DEFAULT__SYSTEM__FULL_PAGE_CACHE__FASTLY__FASTLY_API_KEY
CONFIG__DEFAULT__SYSTEM__FULL_PAGE_CACHE__FASTLY__FASTLY_SERVICE_ID
- Search for the same variables mentioned above:
- Copy the Credentials:
- Note down the values for use in your Fastly configuration.
Tips and Recommendations
- Environment-Specific Credentials:
- Ensure you’re using the correct credentials for each environment (staging or production) to avoid integration issues.
- Ensure you’re using the correct credentials for each environment (staging or production) to avoid integration issues.
- Secure Your Credentials:
- Store the API Token and Service ID securely to prevent unauthorised access.
- Store the API Token and Service ID securely to prevent unauthorised access.
- Contact Adobe Support:
- If you face difficulties locating the credentials, reach out to your Customer Technical Advisory (CTA) or Adobe Support.
Conclusion to Retrieve Fastly API Token and Service ID
Retrieving the Fastly API Token and Service ID is a straightforward process but varies slightly depending on whether you’re using an Adobe Commerce Pro or Starter project. By following the steps outlined above, you can ensure a smooth integration with Fastly and leverage its performance optimization features effectively.
This setup not only accelerates your Adobe Commerce store but also enhances its scalability and security, creating a better experience for your users.
Thanks to reading blog to Retrieve Fastly API Token and Service ID.
Check detail on fastly for adobe commerce: https://sbdevblog.com/fastly-for-adobe-commerce/