For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
      • AstroFully-managed data operations, powered by Apache Airflow.
      • Astro Private CloudRun Airflow-as-a-service in your environment.
      • Professional ServicesExpert Airflow services for your enterprise's success.
    • Tools
      • Cosmos
      • Orbiter
      • CLI
      • AI SDK
      • Agents
      • Blueprint
      • UpdatesThe State of Airflow 2026See the insights from over 5,800 data practitioners in the full report. Download Now ➔
  • Customers
  • Docs
    • Insights
      • Blog
      • Webinars
      • Resource Library
      • Events
    • Education
      • Academy
      • What is Airflow?
  • Pricing
Get Started Free
    • Astro CLI
    • Quickstart
      • Configure the CLI
      • Use Podman
      • Customize your Dockerfile
      • Authenticate to cloud services
        • AWS
        • GCP
        • Azure
      • Ignore project files
    • CLI reference

Product

  • Platform Overview
  • Astro
  • Astro Observe
  • Astro Private Cloud
  • Security & Trust
  • Pricing

Tools & Services

  • Cosmos
  • Docs
  • Professional Services
  • Product Updates

Use Cases

  • AI Ops
  • Data Observability
  • ETL/ELT
  • ML Ops
  • Operational Analytics
  • All Use Cases

Industries

  • Financial Services
  • Gaming
  • Retail
  • Manufacturing
  • Healthcare
  • All Industries

Resources

  • Academy
  • eBooks & Guides
  • Blog
  • Webinars
  • Events
  • The Data Flowcast Podcast
  • All Resources

Airflow

  • What is Airflow
  • Airflow on Astro
  • Airflow 3.0
  • Airflow Upgrades
  • Airflow Use Cases
  • Airflow 2.x End of Life

Company

  • Our Story
  • Customers
  • Newsroom
  • Careers
  • Contact

Support

  • Knowledge Base
  • Status
  • Contact Support
GitHubYouTubeLinkedInx
  • Legal
  • Privacy
  • Terms of Service
  • Consent Preferences

  • Do Not Sell or Share My Personal information
  • Limit the Use Of My Sensitive Personal Information

Apache Airflow®, Airflow, and the Airflow logo are trademarks of the Apache Software Foundation. Copyright © Astronomer 2026. All rights reserved.

LogoLogo
On this page
  • Prerequisites
  • Retrieve AWS user credentials locally
  • Configure your Astro project
  • Test your credentials with a secrets backend
Configure the CLIAuthenticate to cloud services

Authenticate Astro to AWS

Was this page helpful?
Edit this page
Built with

Prerequisites

  • A user account on AWS with access to AWS cloud resources.
  • The AWS CLI.
  • The Astro CLI.
  • An Astro project.

Retrieve AWS user credentials locally

Run the following command to obtain your user credentials locally:

aws configure

This command prompts you for your Access Key Id, Secret Access Key, Region, and output format. If you log into AWS using single sign-on (SSO), run aws configure sso instead.

The AWS CLI then stores your credentials in two separate files:

  • .aws/config
  • .aws/credentials

The location of these files depends on your operating system:

  • Linux: /home/<username>/.aws
  • Mac: /Users/<username>/.aws
  • Windows: %UserProfile%/.aws

Configure your Astro project

For Airflow 3, use the provided docker-compose.override.yml. For Airflow 2, replace api-server with webserver and remove the dag-processor block.

The Astro CLI runs Airflow in a Docker-based environment. To give Airflow access to your credential files, you’ll mount the .aws folder as a volume in Docker.

  1. In your Astro project, create a file named docker-compose.override.yml with the following configuration:
Mac
Linux
Windows
1version: "3.1"
2services:
3 scheduler:
4 volumes:
5 - /Users/<username>/.aws:/home/astro/.aws:rw
6 api-server:
7 volumes:
8 - /Users/<username>/.aws:/home/astro/.aws:rw
9 triggerer:
10 volumes:
11 - /Users/<username>/.aws:/home/astro/.aws:rw
12 dag-processor:
13 volumes:
14 - /Users/<username>/.aws:/home/astro/.aws:rw

Depending on your Docker configurations, you might have to make your .aws folder accessible to Docker. To do this, open Preferences in Docker Desktop and go to Resources → File Sharing. Add the full path of your .aws folder to the list of shared folders.

  1. In your Astro project’s .env file, add the following environment variables. Make sure that the volume path is the same as the one you configured in the docker-compose.override.yml.
AWS_CONFIG_FILE=/home/astro/.aws/config
AWS_SHARED_CREDENTIALS_FILE=/home/astro/.aws/credentials

When you run Airflow locally, all AWS connections without defined credentials automatically fall back to your user credentials when connecting to AWS. Airflow applies and overrides user credentials for AWS connections in the following order:

  • Mounted user credentials in the ~/.aws/config file.
  • Configurations in aws_access_key_id, aws_secret_access_key, and aws_session_token.
  • An explicit username & password provided in the connection.

For example, if you completed the configuration in this document and then created a new AWS connection with its own username and password, Airflow would use those credentials instead of the credentials in ~/.aws/config.

Test your credentials with a secrets backend

Now that Airflow has access to your user credentials, you can use them to connect to your cloud services. Use the following example setup to test your credentials by pulling values from different secrets backends.

  1. Create a secret for an Airflow variable or connection in AWS Secrets Manager. All Airflow variables and connection keys must be prefixed with the following strings respectively:

    • airflow/variables/<my_variable_name>
    • airflow/connections/<my_connection_id>

    For example when adding the secret variable my_secret_var you will need to give the secret the name airflow/variables/my_secret_var.

    When setting the secret type, choose Other type of secret and select the Plaintext option. If you’re creating a connection URI or a non-dict variable as a secret, remove the brackets and quotations that are pre-populated in the plaintext field.

  2. Add the following environment variables to your Astro project .env file. For additional configuration options, see the Apache Airflow documentation. Make sure to specify your region_name.

    AIRFLOW__SECRETS__BACKEND=airflow.providers.amazon.aws.secrets.secrets_manager.SecretsManagerBackend
    AIRFLOW__SECRETS__BACKEND_KWARGS={"connections_prefix": "airflow/connections", "variables_prefix": "airflow/variables", "region_name": "<your-aws-region>"}
  3. Run the following command to start Airflow locally:

    1astro dev start
  4. Access the Airflow UI at localhost:8080 and create an Airflow AWS connection named aws_standard with no credentials. See Connections.

    When you use this connection in your dag, it will fall back to using your configured user credentials.

  5. Add a dag which uses the secrets backend to your Astro project dags directory. You can use the following example dag to retrieve <my_variable_name> and <my_connection_id> from the secrets backend and print it to the terminal:

    1from airflow.models.dag import DAG
    2from airflow.hooks.base import BaseHook
    3from airflow.models import Variable
    4from airflow.decorators import task
    5from datetime import datetime
    6
    7with DAG(
    8 'example_secrets_dag',
    9 start_date=datetime(2022, 1, 1),
    10 schedule=None
    11):
    12
    13 @task
    14 def print_var():
    15 my_var = Variable.get("<my_variable_name>")
    16 print(f"My secret variable is: {my_var}") # secrets will be masked in the logs!
    17
    18 conn = BaseHook.get_connection(conn_id="<my_connection_id>")
    19 print(f"My secret connection is: {conn.get_uri()}") # secrets will be masked in the logs!
    20
    21 print_var()
  6. In the Airflow UI, unpause your dag and click Play to trigger a dag run.

  7. View logs for your dag run. If the connection was successful, your masked secrets appear in your logs. See Airflow logging.

Secrets in logs