Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Sync S3 Bucket different credentials. copy from sts temp to iam role

09 Mar 2023 »
apk add rclone

aws sts assume-role --role-arn "arn:aws:iam::<acc-id>:role/role-s3-full" --role-session-name other
{
    "Credentials": {
        "AccessKeyId": "ASIAYIT5xxxxxxxxxxxx",
        "SecretAccessKey": "Ha3Ei1lxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "SessionToken": "FwoGZXIvYXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "Expiration": "2023-03-09T06:16:43Z"
    },
    "AssumedRoleUser": {
        "AssumedRoleId": "AROAxxxxxxxxxxxVJMDBS:other",
        "Arn": "arn:aws:sts::acc-id:assumed-role/role-s3-full/other"
    }
}

query

rclone -q ls orig:<src-acc-id>-lakeformation-spec/
rclone -q ls dest:<target-acc-id>-us-east-1-test/

sync

rclone sync \
    orig:<orig-acc>-lakeformation-spec/db_dummy_json/date=2022-11-01/ \
    dest:<dest-acc>-us-east-1-test/lol/test/2/

cat .config/rclone/rclone.conf

[orig]
type = s3
provider = AWS
env_auth = true
region = us-east-1
acl = private
server_side_encryption = AES256

[dest]
type = s3
provider = AWS
access_key_id = ASIAYIT5F2L
secret_access_key = Ha3Ei1lQgioonjLvXKfR
region = us-east-1
acl = private
server_side_encryption = AES256
bucket_acl = private
session_token = FwoGZXIvYXdzEK///////////wEaDPGIr