Repository: astronomer/astro-sdk

Issue:
Use standard AWS environment variables
**Context**
At the moment, Astro 0.6.x uses a custom environment variable `AIRFLOW__ASTRO__CONN_AWS_DEFAULT` to define AWS credentials. However, there are standard [AWS environment variables to define credentials](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-environment-variables).

**Acceptance criteria**
* Replace any occurrence of `AIRFLOW__ASTRO__CONN_AWS_DEFAULT`  by `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`


Discussion:

Resolving patch:
diff --git a/src/astro/utils/cloud_storage_creds.py b/src/astro/utils/cloud_storage_creds.py
--- a/src/astro/utils/cloud_storage_creds.py
+++ b/src/astro/utils/cloud_storage_creds.py
@@ -14,14 +14,7 @@
 
 
 def parse_s3_env_var():
-    raw_data = (
-        os.environ["AIRFLOW__ASTRO__CONN_AWS_DEFAULT"]
-        .replace("%2F", "/")
-        .replace("aws://", "")
-        .replace("@", "")
-        .split(":")
-    )
-    return [parse.unquote(r) for r in raw_data]
+    return os.environ["AWS_ACCESS_KEY_ID"], os.environ["AWS_SECRET_ACCESS_KEY"]
 
 
 def s3fs_creds(conn_id=None):


Test patch:
diff --git a/tests/operators/test_agnostic_load_file.py b/tests/operators/test_agnostic_load_file.py
--- a/tests/operators/test_agnostic_load_file.py
+++ b/tests/operators/test_agnostic_load_file.py
@@ -19,7 +19,8 @@
 Requires the unittest, pytest, and requests-mock Python libraries.
 
 Run test:
-    AIRFLOW__ASTRO__CONN_AWS_DEFAULT=aws://AKIAZG42HVH6Z3B6ELRB:SgwfrcO2NdKpeKhUG77K%2F6B2HuRJJopbHPV84NbY@ \
+    AWS_ACCESS_KEY_ID=AKIAZG42HVH6Z3B6ELRB \
+    AWS_SECRET_ACCESS_KEY=SgwfrcO2NdKpeKhUG77K%2F6B2HuRJJopbHPV84NbY \
     python3 -m unittest tests.operators.test_agnostic_load_file.TestAgnosticLoadFile.test_aql_local_file_to_postgres
 
 """
@@ -478,9 +479,7 @@ def test_aql_gcs_file_to_postgres(self):
 
 @mock.patch.dict(
     os.environ,
-    {
-        "AIRFLOW__ASTRO__CONN_AWS_DEFAULT": "abcd:%40%23%24%25%40%24%23ASDH%40Ksd23%25SD546@"
-    },
+    {"AWS_ACCESS_KEY_ID": "abcd", "AWS_SECRET_ACCESS_KEY": "@#$%@$#ASDH@Ksd23%SD546"},
 )
 def test_aws_decode():
     from astro.utils.cloud_storage_creds import parse_s3_env_var
diff --git a/tests/operators/test_agnostic_save_file.py b/tests/operators/test_agnostic_save_file.py
--- a/tests/operators/test_agnostic_save_file.py
+++ b/tests/operators/test_agnostic_save_file.py
@@ -19,7 +19,8 @@
 Requires the unittest, pytest, and requests-mock Python libraries.
 
 Run test:
-    AIRFLOW__ASTRO__CONN_AWS_DEFAULT=aws://KEY:SECRET@
+    AWS_ACCESS_KEY_ID=KEY \
+    AWS_SECRET_ACCESS_KEY=SECRET \
     python3 -m unittest tests.operators.test_save_file.TestSaveFile.test_save_postgres_table_to_local
 
 """
@@ -362,15 +363,11 @@ def _s3fs_creds():
         s3fs enables pandas to write to s3
         """
         # To-do: clean-up how S3 creds are passed to s3fs
-        k, v = (
-            os.environ["AIRFLOW__ASTRO__CONN_AWS_DEFAULT"]
-            .replace("%2F", "/")
-            .replace("aws://", "")
-            .replace("@", "")
-            .split(":")
-        )
 
-        return {"key": k, "secret": v}
+        return {
+            "key": os.environ["AWS_ACCESS_KEY_ID"],
+            "secret": os.environ["AWS_SECRET_ACCESS_KEY"],
+        }
 
 
 @pytest.fixture
diff --git a/tests/operators/test_postgres_append.py b/tests/operators/test_postgres_append.py
--- a/tests/operators/test_postgres_append.py
+++ b/tests/operators/test_postgres_append.py
@@ -20,7 +20,8 @@
 Requires the unittest, pytest, and requests-mock Python libraries.
 
 Run test:
-    AIRFLOW__ASTRO__CONN_AWS_DEFAULT=aws://KEY:SECRET@ \
+    AWS_ACCESS_KEY_ID=KEY \
+    AWS_SECRET_ACCESS_KEY=SECRET \
     python3 -m unittest tests.operators.test_postgres_operator.TestPostgresOperator.test_load_s3_to_sql_db
 
 """
diff --git a/tests/operators/test_sqlite_append.py b/tests/operators/test_sqlite_append.py
--- a/tests/operators/test_sqlite_append.py
+++ b/tests/operators/test_sqlite_append.py
@@ -20,7 +20,8 @@
 Requires the unittest, pytest, and requests-mock Python libraries.
 
 Run test:
-    AIRFLOW__ASTRO__CONN_AWS_DEFAULT=aws://KEY:SECRET@ \
+    AWS_ACCESS_KEY_ID=KEY \
+    AWS_SECRET_ACCESS_KEY=SECRET \
     python3 -m unittest tests.operators.test_postgres_operator.TestPostgresOperator.test_load_s3_to_sql_db
 
 """