ramazon-web-servicesamazon-s3amazon-sagemakervetiver

Problems deploying an ML model to AWS Sagemaker using R and Vetiver


I'm following along to this blog however I'm using palmer penguins for my model development and I'm at the stage of generating and building a Docker image on SageMaker for a vetiver model in R.

When I run the following:

new_image_uri <- 
  vetiver_sm_build(
  bucket = "ml-bucket-my-name",
  name = "penguin_model",
  board = board
)

I get the following error:

* Lockfile written to 'vetiver_renv.lock'.
WARN [2023-08-09 23:19:06.410]: Couldn't call 'get_role' to get Role ARN from role name my-name to get Role path.
Error: The current AWS identity is not a role: arn:aws:iam::123456789:user/my-name, therefore it cannot be used as a SageMaker execution role

When setting up my AWS environment I followed along to this blog where the author suggests setting up an IAM user and then granting full s3 access which I've done as shown below.

Is there some other step I'm missing to allow me to pin my model to my board in the S3 bucket?

enter image description here


Solution

  • You might find it helpful to take a look at this code and see what happens when you call smdocker::sagemaker_get_execution_role() in your environment.

    If you are working locally but interacting with AWS and SageMaker resources, then you will need to explicitly pass the role arg to vetiver_sm_build(). Take a look at this discussion to see steps you'll need to take.