Skip to content

Reading object in s3 bucket from ecs fargate task #9

@Ada-Nick

Description

@Ada-Nick

Please specify whether your issue is about:

  • a possible bug
  • a question about package functionality
  • a suggested code or documentation change, improvement to the code, or feature request

I have a shiny app running on an ecs fargate task using the rocker:shiny-verse base docker image. I can't read an s3 file
within the initialisation of the shiny app (global.R file). Interestingly it does work when I change the method of serving the app in the docker file.

The docker command that works is:

CMD ["R", "-e", "shiny::runApp('/srv/shiny-server/my_app', 3838, host='0.0.0.0')"]

And the method I want to use but doesn't work:

CMD ["/usr/bin/shiny-server.sh"]

What is the intended method of accessing the permissions granted to the IAM role, how can I read from the s3 bucket within an ecs fargate task?

My global.R file looks like this:

## load package
library(ini)
library("aws.ec2metadata")

Sys.setenv("AWS_DEFAULT_REGION" = "eu-west-2")
if (is_ecs() == T) {
   metadata$iam_role("ecsTaskExecutionRole")
}

config = aws.s3::s3read_using(read.ini,
                              object = 'my_object.ini',
                              bucket = 'my_bucket')

I can't get the session Info of the Fargate task or any logs but know it's the s3 connection that is failing as removing the
s3_read_using() call allows the app to run as expected. I have also double checked that the ecsTaskExecutionRole has s3 read
permissions required. The bucket also definitely exists and as does the object and it's in the correct region (eu-west-2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions