예제 #1
0
def test_describe_instances(credentials,
                            query_request_handler,
                            region='us-east-1'):
    query_request = QueryRequest(
        credentials=credentials,
        method='GET',
        service="ec2",
        host='ec2.amazonaws.com',
        region='us-east-1',
        endpoint='https://ec2.amazonaws.com',
        content_type='application/x-www-form-urlencoded',
        request_parameters='Action=DescribeInstances&Version=2013-10-15')
    query_request_handler.performRequest(query_request)
예제 #2
0
def test_terminate_instances(credentials,
                             query_request_handler,
                             region='us-east-1'):
    request_parameters_map = {
        'Action': 'DescribeDBInstances',
        'Version': '2014-09-01'
    }
    request_parameters = urllib.parse.urlencode(request_parameters_map)
    query_request = QueryRequest(
        credentials=credentials,
        method='POST',
        service="rds",
        host='rds.amazonaws.com',
        region='us-east-1',
        endpoint='https://rds.amazonaws.com',
        content_type='application/x-www-form-urlencoded',
        request_parameters=request_parameters)
    query_request_handler.performRequest(query_request)
예제 #3
0
def test_terminate_instances(credentials,
                             query_request_handler,
                             region='us-east-1'):
    request_parameters_map = {
        'InstanceId.1': 'i-07185aa5f1e0cf9ac',
        'Action': 'TerminateInstances',
        'Version': '2016-11-15'
    }
    request_parameters = urllib.parse.urlencode(request_parameters_map)
    query_request = QueryRequest(
        credentials=credentials,
        method='POST',
        service="ec2",
        host='ec2.amazonaws.com',
        region='us-east-1',
        endpoint='https://ec2.amazonaws.com',
        content_type='application/x-www-form-urlencoded',
        request_parameters=request_parameters)
    query_request_handler.performRequest(query_request)
예제 #4
0
def test_run_instances(credentials, query_request_handler, region='us-east-1'):
    request_parameters_map = {
        'Action': 'RunInstances',
        'ImageId': 'ami-02da3a138888ced85',
        'MaxCount': 1,
        'MinCount': 1,
        'KeyName': 'samir-test-key-pair-us-east-1',
        'Version': '2016-11-15'
    }
    request_parameters = urllib.parse.urlencode(request_parameters_map)
    query_request = QueryRequest(
        credentials=credentials,
        method='POST',
        service="ec2",
        host='ec2.amazonaws.com',
        region='us-east-1',
        endpoint='https://ec2.amazonaws.com',
        content_type='application/x-www-form-urlencoded',
        request_parameters=request_parameters)
    query_request_handler.performRequest(query_request, region='us-east-1')
예제 #5
0
def test_create_db_instances(credentials,
                             query_request_handler,
                             region='us-east-1'):
    request_parameters_map = {
        'DBInstanceClass': 'db.t2.micro',
        'Engine': 'postgres',
        'DBInstanceIdentifier': 'rds-12',
        'MasterUsername': '******',
        'MasterUserPassword': '******',
        'AllocatedStorage': '15',
        'Action': 'CreateDBInstance',
        'Version': '2014-09-01'
    }
    request_parameters = urllib.parse.urlencode(request_parameters_map)
    query_request = QueryRequest(
        credentials=credentials,
        method='POST',
        service="rds",
        host='rds.amazonaws.com',
        region='us-east-1',
        endpoint='https://rds.amazonaws.com',
        content_type='application/x-www-form-urlencoded',
        request_parameters=request_parameters)
    query_request_handler.performRequest(query_request)