How to Retrieve Fastly API Token and Service ID for Adobe Commerce

How to Retrieve Fastly API Token and Service ID for Adobe Commerce - SBDEVBLOG

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:

  1. Connect to the Server:
    • Use SSH to access the server where your Adobe Commerce instance is hosted.

  2. Navigate to the Shared Directory:
    • Switch to the shared directory by running
      cd /mnt/shared/
  3. Locate the Fastly Tokens File:
    • Search for the fastly_tokens.txt file in this directory.
  4. 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.

  1. Access Environment Variables:
    • Run the following command to list all environment variables:bash
      Copy code
      magento-cloud variable:get -e <environment-ID>
    • Replace <environment-ID> with the specific identifier for your environment (e.g., stagingproduction).
  2. 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
  3. Retrieve the Values:
    • 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.

  1. Log in to the Console:
    • Access your Adobe Commerce Cloud account and navigate to the specific project environment (e.g., staging, production).
  2. 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
  3. Copy the Credentials:
    • Note down the values for use in your Fastly configuration.

Tips and Recommendations

  1. Environment-Specific Credentials:
    • Ensure you’re using the correct credentials for each environment (staging or production) to avoid integration issues.
  2. Secure Your Credentials:
    • Store the API Token and Service ID securely to prevent unauthorised access.
  3. 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.

Source: https://experienceleague.adobe.com/en/docs/commerce-cloud-service/user-guide/cdn/setup-fastly/fastly-configuration?utm_source=chatgpt.com

Check detail on fastly for adobe commerce: https://sbdevblog.com/fastly-for-adobe-commerce/

Leave a Reply

Your email address will not be published. Required fields are marked *