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
| #!/bin/bash | |
| set -ve | |
| # get the deploy role and region from the settings file | |
| deployRole="role_name" | |
| deployRegion="region" | |
| # assume the deploy role | |
| if [ -n "$deployRole" ]; then | |
| assumedRoleDetails=$(aws sts assume-role --role-arn $deployRole --role-session-name ui-deploy) |
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
| pre_query = "truncate table target_table" | |
| post_query= "begin;delete from target_table using stage_table where stage_table.id = target_table.id ; insert into target_table select * from stage_table; drop table stage_table; end;" | |
| connection_options_redshift = { | |
| "preactions": pre_query, | |
| "dbtable": "stage_table", | |
| "database": "redshiftdb", | |
| "postactions":post_query | |
| } |
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
| variable "default_tags" { | |
| type = "map" | |
| default = {} | |
| } | |
| default_tags = { | |
| foo = "bar" | |
| } | |
| ... |
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 boto3 | |
| import pandas as pd | |
| import time | |
| import io | |
| start = time.time() | |
| s3 = boto3.client('s3') | |
| s3_resource = boto3.resource('s3') |
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
| #!/usr/bin/python3 | |
| import boto3 | |
| import pandas as pd | |
| import time | |
| import io | |
| s3 = boto3.client('s3') | |
| s3_resource = boto3.resource('s3') |
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
| def s3_select(bucket, key, statement): | |
| s3_select_results = s3.select_object_content( | |
| Bucket=bucket, | |
| Key=key, | |
| Expression=statement, | |
| ExpressionType='SQL', | |
| InputSerialization={'CSV': {"FileHeaderInfo": "Use"}}, | |
| OutputSerialization={'JSON': {}}, | |
| ) |
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 os | |
| import site | |
| from setuptools.command import easy_install | |
| install_path = os.environ['GLUE_INSTALLATION'] | |
| easy_install.main( ["--install-dir", install_path, "<library-name>"] ) | |
| reload(site) | |
| import <installed library> |
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
| # Install Chrome | |
| # Update browser default settings | |
| # Install VSCode | |
| # Install iTerm2 | |
| # Install PyCharm | |
| # Install Homebrew |
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 boto3 | |
| from botocore.exceptions import ClientError | |
| try: | |
| iam = boto3.client('iam') | |
| user = iam.create_user(UserName='fred') | |
| print("Created user: %s" % user) | |
| except ClientError as e: | |
| if e.response['Error']['Code'] == 'EntityAlreadyExists': | |
| print("User already exists") |
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
| // The user that will execute the crawl needs: | |
| execute ,SELECT, SHOW VIEW ON `database`.* |