mup-aws-beanstalk icon indicating copy to clipboard operation
mup-aws-beanstalk copied to clipboard

Documentation Needed: `longEnvVars` option requires S3 read access for the instances (?)

Open convexset opened this issue 5 years ago • 5 comments

Looks like the longEnvVars option requires S3 read access for the instances.

I tried it some time back and it didn't work and I was in too much of a hurry to get it working. Now that I know a bit more about EB and have looked in the source code it seems like that's the case. https://github.com/zodern/mup-aws-beanstalk/blob/master/src/assets/env.yaml#L48

If that's right, it should be added to the documentation while doing this.

convexset avatar Jul 11 '19 10:07 convexset

Thanks for making this issue. 🙏

jpaddison3 avatar Mar 26 '20 16:03 jpaddison3

I am not able to reproduce. The instance profile is aws-elasticbeanstalk-ec2-role, which has read access to the s3 bucket.

zodern avatar Oct 01 '21 01:10 zodern

The AWS-elasticbeanstalk-ec2-role does not have a permission to access s3 mup-APPNAME/env. We need to have an additional permission attaches to that role.

Ref: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html

hugo-medcury avatar Aug 02 '22 17:08 hugo-medcury

For those who stuck with longEnvVars, please check:

  1. Go to IAM
  2. Role
  3. Select aws-elasticbeanstalk-ec2-role
  4. Add permissions
  5. Create inline policy
  6. JSON
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::mup-YOUR_APP_NAME",
                "arn:aws:s3:::mup-YOUR_APP_NAME/*"
            ]
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": "arn:aws:s3:::*"
        }
    ]
}

Save the setting.

hugo-medcury avatar Aug 05 '22 06:08 hugo-medcury

Additionally, I was getting a NoSuchKey error. In my mup-<app>/env' folder, a '0.txt' file was expected. It was not there, probably because this is an old app and I was switching to longEnvVars` now.

So, I added a dummy 0.txt file and it started working.

@zodern fyi.

s7dhansh avatar Aug 29 '22 15:08 s7dhansh