Last active
March 29, 2018 14:50
-
-
Save lizturp/077e54ea2af0c1742fd43187546477d8 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import boto3 | |
import argparse | |
# Available args: | |
# Environment | |
# --env dev, stage or prod | |
# | |
# run the script from a command line like so: | |
# python boto-s3-things.py --env=stage | |
# Adding this snippet allows you to make the script run for stage vs. prod | |
# This way, you can test changes to it without messing up what you already have scheduled | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--env", default='stage', help='environment to execute script against') | |
args = parser.parse_args() | |
env = args.env | |
#GET A FILE FROM S3 | |
# SET LOCATION | |
bucket = 'bucket-name-here' | |
configfilename = 'config.yaml' | |
configkey = "config-{environment}/adobe-analytics/{file}".format(environment=env, file=configfilename) | |
# This downloads the file to your working directory | |
s3 = boto3.resource('s3') | |
s3.meta.client.download_file(bucket, configkey, configfilename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment