When i invoke the endpoint/batch job in sagemaker deployed with a custom container i want to store some information inside S3.
For example, in this image

In the "Deployment/Hosting" i want to put some objects inside the S3 container and not only reading the /opt/model
For example BYO container R
In the plumber.R function i would like to:
function(req) {
# Setup locations
prefix <- '/opt/ml'
model_path <- paste(prefix, 'model', sep='/')
# Bring in model file and factor levels
load(paste(model_path, 'mars_model.RData', sep='/'))
# Read in data
conn <- textConnection(gsub('\\\\n', '\n', req$postBody))
data <- read.csv(conn)
close(conn)
# Convert input to model matrix
scoring_X <- model.matrix(~., data, xlev=factor_levels)
####
SAVE OBJECT IN S3
#####
# Return prediction
return(paste(predict(mars_model, scoring_X, row.names=FALSE), collapse=','))}
How can i achieve this? Using aws.s3 connecting to the container or with other techniques?
EDIT: The aws.s3 solution to connect directly inside the container seems not working