Пример #1
0
def cloudwatch_connect_to_region(region):
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    try:
        conn =  boto.ec2.cloudwatch.connect_to_region(region, aws_access_key_id=access_key, aws_secret_access_key=secret_access_key)
    except:
        print "Unexpected error:", sys.exc_info()[0]
    else:
        return conn
Пример #2
0
def cloudwatch_connect_to_region(region):
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    try:
        conn =  boto.ec2.cloudwatch.connect_to_region(region, aws_access_key_id=access_key, aws_secret_access_key=secret_access_key)
    except:
        print "Unexpected error:", sys.exc_info()[0]
    else:
        return conn
Пример #3
0
def validate_config():
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    if access_key == '<access_key_id>' or secret_access_key == '<secret_access_key>':
      sys.stderr.write("Cloudwatch Collector is not configured\n")
      sys.exit(13)
    if not aws_cloudwatch_conf.enabled:
      sys.stderr.write("Cloudwatch Collector is not enabled\n")
      sys.exit(13)
Пример #4
0
def validate_config():
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    if access_key == '<access_key_id>' or secret_access_key == '<secret_access_key>':
      sys.stderr.write("Cloudwatch Collector is not configured\n")
      sys.exit(13)
    if not aws_cloudwatch_conf.enabled:
      sys.stderr.write("Cloudwatch Collector is not enabled\n")
      sys.exit(13)
Пример #5
0
def validate_config():
    aws_profile = aws_cloudwatch_conf.get_aws_profile()
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    if (access_key == '<access_key_id>' or secret_access_key == '<secret_access_key>') and aws_profile is None:
        utils.err("Cloudwatch Collector is not configured\n")
        sys.exit(13)
    if not aws_cloudwatch_conf.enabled:
        utils.err("Cloudwatch Collector is not enabled\n")
        sys.exit(13)
Пример #6
0
def cloudwatch_init_boto_client(region):
    client_name = 'cloudwatch'
    aws_profile = aws_cloudwatch_conf.get_aws_profile()
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    if (((access_key is not None) and (access_key != '<access_key_id>')) and (
            #sys.stderr.write("using access keys\n")
                (secret_access_key is not None) and (secret_access_key != '<secret_access_key>'))):
        boto_client = boto3.client(
            client_name,
            aws_access_key_id=access_key,
            aws_secret_access_key=secret_access_key,
            region_name=region
        )
    elif aws_profile is not None:
        #sys.stderr.write("Using aws_profile: %s\n" % (aws_profile))
        session = boto3.session.Session(profile_name=aws_profile)
        boto_client = session.client(client_name, region_name=region)
    else:
        #sys.stderr.write("connecting with no auth info, good luck")
        boto_client = boto3.client(client_name, region_name=region)

    return boto_client
Пример #7
0
def ec2_connect_to_region(region):
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    return boto.ec2.connect_to_region(region, aws_access_key_id=access_key, aws_secret_access_key=secret_access_key)
Пример #8
0
def ec2_connect_to_region(region):
    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()
    return boto.ec2.connect_to_region(region, aws_access_key_id=access_key, aws_secret_access_key=secret_access_key)