In this section, you’ll learn how to use AWS Systems Manager (SSM) Parameter Store as a secrets backend on Astro Private Cloud.Documentation Index
Fetch the complete documentation index at: https://astronomer-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Deployment.
- The Astro CLI.
- An Astro project initialized with
astro dev init. - Access to AWS SSM Parameter Store.
- A valid AWS Access Key ID and Secret Access Key.
Step 1: Write an Airflow variable or connection to AWS Parameter Store
To start, add an Airflow variable or connection as a secret to Parameter Store for testing. For instructions, see the AWS documentation on how to do so using the AWS Systems Manager Console, the AWS CLI, or Tools for Windows PowerShell. Variables and connections should live at/airflow/variables and /airflow/connections, respectively. For example, if you’re setting a secret variable with the key my_secret, it should exist at /airflow/connections/my_secret.
Step 2: Set up AWS Parameter Store locally
To test AWS Parameter Store locally, configure it as a secrets backend in your Astro project. First, install the Airflow provider for Amazon by adding the following to your project’srequirements.txt file:
Dockerfile:
If you want to deploy your project to a hosted Git repository before deploying to Astro Private Cloud, be sure to save
<your-aws-key>and<your-aws-secret-key>in a secure manner. When you deploy to Astro Private Cloud, use the UI to set these values as secrets.Step 3: Run an example Dag to test AWS Parameter Store locally
To test Parameter Store, write a simple Dag which calls your secret and add this Dag to your Astro project’sdags directory.
For example, you can use the following Dag to print the value of an Airflow variable to your task logs:
-
Run
astro dev restartto push your changes to your local Airflow environment. -
In the Airflow UI (
http://localhost:8080/admin/), trigger your new Dag. -
Click on
test-task> View Logs. If you ran the example Dag above, you should see the contents of your secret in the task logs:
Step 4: Deploy to Astro Private Cloud
Once you’ve confirmed that the integration with AWS SSM Parameter Store works locally, you can complete a similar set up with a Deployment on Astro Private Cloud.- In the Astro Private Cloud UI, add the same environment variables found in your
Dockerfileto your Deployment environment variables. Specify bothAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYas secret ensure that your credentials are stored securely. - In your Astro project, delete the environment variables from your
Dockerfile. - Deploy your changes to Astro Private Cloud.