This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import re | |
| import argparse | |
| import requests | |
| def main(): | |
| args = parse_args() | |
| gist_id = find_id(args.url, args.follow_redirects) | |
| print(f"Found gist ID {gist_id}") | |
| gist_api_adaptor = GistAPIAdaptor(gist_id) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Finally: Run our copy! | |
| aws s3 cp s3://source s3://destination --recursive --profile porter | |
| copy: s3://source/1.txt to s3://destination/1.txt | |
| copy: s3://source/2.txt to s3://destination/2.txt | |
| ... | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [source-admin] | |
| aws_access_key_id = some-access-id | |
| aws_secret_access_key = some-secret | |
| [destination-admin] | |
| aws_access_key_id = some-access-id-2 | |
| aws_secret_access_key = some-secret-2 | |
| [porter] | |
| aws_access_key_id = access-key-id | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Set up our source and destination buckets | |
| % aws kms create-key --profile destination-admin | |
| ... | |
| "KeyId": "destination-key-id", | |
| ... | |
| % aws kms create-key --profile source-admin --policy file://source-encryption-key.json | |
| ... | |
| "KeyId": "source-key-id", | |
| ... | |
| % aws s3 mb s3://destination --profile destination-admin | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2012-10-17", | |
| "Id": "key-default-1", | |
| "Statement": [ | |
| { | |
| "Sid": "Enable IAM User Permissions", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "AWS": "arn:aws:iam::source-account-id:root" | |
| }, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2008-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Principal": { | |
| "AWS": "arn:aws:iam::destination-account:role/S3Porter" | |
| }, | |
| "Action": [ | |
| "s3:GetObject", | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2012-10-17", | |
| "Id": "key-default-1", | |
| "Statement": [ | |
| { | |
| "Sid": "Enable IAM User Permissions", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "AWS": "arn:aws:iam::destination-account-id:root" | |
| }, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "AllowS3CopyFromSource", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "s3:GetObject", | |
| "s3:ListBucket" | |
| ], | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "AllowEC2", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": "ec2.amazonaws.com" | |
| }, | |
| "Action": "sts:AssumeRole" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "VisualEditor0", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "iam:CreateRole", | |
| "iam:CreateUser" | |
| ], | 
NewerOlder