{"library":"apache-airflow-providers-amazon","code":"from __future__ import annotations\n\nimport os\n\nimport pendulum\n\nfrom airflow.models.dag import DAG\nfrom airflow.providers.amazon.aws.operators.s3 import S3CopyObjectOperator\n\n# Ensure AWS credentials are configured in Airflow Connection 'aws_default'\n# or via environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)\n# For local testing, you can mock this or use dummy values if S3 interaction isn't critical.\n\nwith DAG(\n    dag_id=\"example_s3_copy_dag\",\n    start_date=pendulum.datetime(2023, 1, 1, tz=\"UTC\"),\n    catchup=False,\n    schedule=None,\n    tags=[\"s3\", \"aws\", \"example\"],\n) as dag:\n    copy_s3_object = S3CopyObjectOperator(\n        task_id=\"copy_s3_object_task\",\n        source_bucket_key=f\"s3://{os.environ.get('SOURCE_BUCKET', 'my-source-bucket')}/source_file.txt\",\n        dest_bucket_key=f\"s3://{os.environ.get('DEST_BUCKET', 'my-dest-bucket')}/dest_file.txt\",\n        aws_conn_id=\"aws_default\", # Assumes 'aws_default' connection is configured in Airflow\n    )\n","lang":"python","description":"This example demonstrates a basic Airflow DAG that uses the `S3CopyObjectOperator` from the Amazon provider to copy an object between two S3 buckets. Ensure you have an Airflow connection named `aws_default` configured with appropriate AWS credentials and permissions, or set AWS environment variables.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}