how to instantiate aws resources within sagemaker environment?

0

I am setting up a sagemaker processing job in sagemaker, as a part of sagemaker pipeline (see sample below)

in my script file , i instantiate a dynamo db client from boto3 library but before that i instantiate a session via boto3.Session(profile_name='myprofile') . within sagemaker , do we need to provide a profile name , or does boto3 creates a default profile , as it is already running within aws sagemaker environment? if yes, do i just import boto3 or do i need any other sagemaker libraries.

if no, how do i create a profile within aws sagemaker?

main.py

import boto3


session = boto3.Session(profile_name='profile')

dynamodb = session.client('dynamodb', ..)

my_processor = ScriptProcessor(
    command=['python3'],
    ...
)

my_step = ProcessingStep(
    "MyPreprocessStep",
    code=main.py,
    inputs=[...],
    arguments=["--flag"],
    ...
)
已提问 1 个月前121 查看次数
1 回答
0

The session is created for you by default. But you don't need to initiate a session explicitly, just create the client and its done for you:

import boto3

client = boto3.client('dynamodb')
profile pictureAWS
专家
已回答 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则