Example #1
0
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region)

def processParameter(parameter, region_name, account_id):
    replacement = parameter[1].replace('{REGION}', region_name).replace('{ACCOUNT}', account_id)
    processedParameter = tuple([parameter[0], replacement])
    return processedParameter

def processArgument(argument, region_name, account_id):
    return argument.replace('{REGION}', region_name).replace('{ACCOUNT}', account_id)

# execute business logic
log.info("Updating CloudFormation stacks named '" + args.stack_name + "':")

iam = boto.connect_iam(**credentials)
accountInfo = AccountInfo(iam)
account = accountInfo.describe()

parameters = dict([])
if args.parameter:
    parameters = dict([parameter.split('=') for parameter in args.parameter])

notification_arns = []
if args.notification_arn:
    notification_arns = args.notification_arn

capabilities = []
if args.enable_iam:
    capabilities.append('CAPABILITY_IAM')

for region in regions:
Example #2
0
import argparse
import boto
import botocross as bc
import logging
import sys

# configure command line argument parsing
parser = argparse.ArgumentParser(description='Validates AWS credentials and display account/user information',
                                 parents=[bc.build_common_parser()])
args = parser.parse_args()

# process common command line arguments
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)

# execute business logic
log.info("Validating credentials:")

try:
    iam = boto.connect_iam(**credentials)
    userInfo = UserInfo(iam)
    user = userInfo.describe()
    accountInfo = AccountInfo(iam)
    account = accountInfo.describe(user)
    print "User name is '" + user.name + "' with id " + user.id
    print "Account alias is '" + account.alias + "' with id " + account.id
except boto.exception.BotoServerError, e:
    log.exception(e)
    sys.exit(bc.ExitCodes.FAIL)
Example #3
0
def createTopicArn(region_name, topic_name):
    from botocross.iam.accountinfo import AccountInfo
    iam = boto.connect_iam(**credentials)
    accountInfo = AccountInfo(iam)
    account = accountInfo.describe()
    return 'arn:aws:sns:' + region_name + ':' + account.id + ':' + topic_name
Example #4
0
def create_arn(iam, service, region, resource):
    from botocross.iam.accountinfo import AccountInfo
    accountInfo = AccountInfo(iam)
    account = accountInfo.describe()
    return 'arn:aws:' + service + ':' + region + ':' + account.id + ':' + resource
Example #5
0
def createTopicArn(region_name, topic_name):
    from botocross.iam.accountinfo import AccountInfo
    iam = boto.connect_iam(**credentials)
    accountInfo = AccountInfo(iam)
    account = accountInfo.describe()
    return 'arn:aws:sns:' + region_name + ':' + account.id + ':' + topic_name
Example #6
0
def create_arn(iam, service, region, resource):
    from botocross.iam.accountinfo import AccountInfo
    accountInfo = AccountInfo(iam)
    account = accountInfo.describe()
    return 'arn:aws:' + service + ':' + region + ':' + account.id + ':' + resource