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"],
    ...
)
질문됨 한 달 전122회 조회
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
전문가
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인