def assert_credentials_are_valid(self, parameters):
    """Contacts AWS to see if the given access key and secret key represent a
    valid set of credentials.

    Args:
      parameters: A dict containing the user's AWS access key and secret key.
    Raises:
      AgentConfigurationException: If the given AWS access key and secret key
      cannot be used to make requests to AWS.
    """
    conn = self.open_connection(parameters)
    try:
      conn.get_all_instances()
    except EC2ResponseError:
      raise AgentConfigurationException("We couldn't validate your EC2 " + \
        "access key and EC2 secret key. Are your credentials valid?")
dataset/ETHPy150Open AppScale/appscale-tools/lib/agents/ec2_agent.py/EC2Agent.assert_credentials_are_valid/original