AWS Botocore Config

Hello!
I wonder why we need to use “user_agent_extra”? I’ve read the documentation and now I know that it represents “the value to append to the current User-Agent header value”. But could you clarify what’s the purpose we include it here:
config = botocore.config.Config(user_agent_extra=‘dlai-pds/c1/w3’)

And how should I change it if I would like to repeat similar lab activities with my own aws account?

Hi there! Any response from our mentors would be appreciated.

Hi @Danila,

Can you also mention the exercise cell? I also could not find much info online on the parameter “user_agent_extra”. I will raise the question to the team, May be the team can provide more info?

Best Regards,
A. Sriharsha

Hi, @sriharsha0806
Sure, it’s the second cell in the section right before the section 1. Review and Transform Dataset (notebook C1_W3_Assignment.ipynb):

import boto3
import sagemaker
import pandas as pd
import numpy as np
import botocore
import time
import json

config = botocore.config.Config(user_agent_extra='dlai-pds/c1/w3')

# low-level service client of the boto3 session
sm = boto3.client(service_name='sagemaker', 
                  config=config)

sm_runtime = boto3.client('sagemaker-runtime',
                          config=config)

sess = sagemaker.Session(sagemaker_client=sm,
                         sagemaker_runtime_client=sm_runtime)

bucket = sess.default_bucket()
role = sagemaker.get_execution_role()
region = sess.boto_region_name

Hi @Danila,

The solution is provided by @esanina

This is an optional field that the instructors are using to monitor the health of the lab materials and troubleshoot issues in this environment. You can just remove this optional user_agent_extra param when using this code in your own AWS account. Removing this optional param will not affect the lab results in any way.

Best Regards,
A. Sriharsha

1 Like