Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

There are various password-based services where it's required to authenticate with credentials. Here are a few examples:

  1. DockerHub
  2. Pip
  3. Maven
  4. NexusCentral
  5. SSH (private key based authentication)
  6. GIT

When to NOT use this guide

...

  1. AWS: For AWS, we should always aim to use IAM based authorization. Authentication is automatically done using the IAM roles the slaves have attached. In case you need assistance with this, feel free to attend the Berlin office hours or attend Berlins Recurring Apache (Incubating) MXNet User Group meeting or send an email to dev@mxnet.apache.org.

...

Code Block
languagepy
titleRetrieving credentials in Python
def _get_credentials():  # pragma: no cover
    import boto3
    import botocore
    secret_name = os.environ['MAVEN_PUBLISH_SECRET_NAME_CREDENTIALS']
    endpoint_url = os.environ['MAVEN_PUBLISH_SECRET_ENDPOINT_URL']
    region_name = os.environ['MAVEN_PUBLISH_SECRET_ENDPOINT_REGION']

    session = boto3.Session()
    client = session.client(
        service_name='secretsmanager',
        region_name=region_name,
        endpoint_url=endpoint_url
    )
    try:
        get_secret_value_response = client.get_secret_value(
            SecretId=secret_name
        )
    except botocore.exceptions.ClientError as client_error:
        if client_error.response['Error']['Code'] == 'ResourceNotFoundException':
            logging.exception("The requested secret %s was not found", secret_name)
        elif client_error.response['Error']['Code'] == 'InvalidRequestException':
            logging.exception("The request was invalid due to:")
        elif client_error.response['Error']['Code'] == 'InvalidParameterException':
            logging.exception("The request had invalid params:")
        else:
            raise
    else:
        secret = get_secret_value_response['SecretString']
        secret_dict = json.loads(secret)
        return secret_dict

...