Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Add S3 Repository for AWS missing role_arn option #209

Closed
gw-bcharboneau opened this issue Feb 15, 2024 · 10 comments
Closed

[BUG] - Add S3 Repository for AWS missing role_arn option #209

gw-bcharboneau opened this issue Feb 15, 2024 · 10 comments
Assignees

Comments

@gw-bcharboneau
Copy link

gw-bcharboneau commented Feb 15, 2024

Description
The UI does not allow adding an S3 Bucket Repository on AWS Managed Clusters because it is missing an option for settings.role_arn
The Following Error is presented:

{"Message":"settings.role_arn is needed for snapshot registration."}

Steps To Reproduce
List the steps to reproduce your problem:

  1. Open elasticvue
  2. Click on Snapshots
  3. Click on New Repository
  4. Fill out info, selecting S3 for repository type
  5. No option to add role_arn is avaialble
  6. Click Create
  7. see error in bottom right corner

Screenshots
image

Environment (please include the following information):

  • Elasticsearch version:
  • Elasticvue version: 1.0.3-stable
  • How are you running elasticvue? Desktop and Firefox Extension
  • Screenshot from windows desktop app

Additional Info
here is an example json body that gets sent to an AWS Elastic/OpenSearch Cluster to create a repo that uses S3

{
    "type": "s3",
    "settings": {
        "bucket": "{{Bucket}}",
        "base_path": "{{SnapshotName}}",
        "role_arn": "{{RoleArn}}",
        "region": "{{Region}}"
    }
}

there are also other optional settings such as 

- "readonly": {true/false}
- "server_side_encryption": {true/false}
@cars10
Copy link
Owner

cars10 commented Feb 16, 2024

Can you provide documentation for the role_arn option? This does not seem to be listed anywhere in the docs.

@gw-bcharboneau
Copy link
Author

gw-bcharboneau commented Feb 16, 2024

sure See Step 2 and select Snapshots as it may default to encrypted snapshots
Creating index snapshots in Amazon OpenSearch Service

image

@cars10
Copy link
Owner

cars10 commented Feb 16, 2024

Thanks, so we are talking about opensearch and not elasticsearch. I will add this to #191

@gw-bcharboneau
Copy link
Author

gw-bcharboneau commented Feb 16, 2024

It’s ElasticSearch too. If it is hosted on AWS, they renamed their service to “AWS OpenSearch Service” but it encompasses both (ElasticSearch Version up to 7.10) and (OpenSearch 1.x and 2.x). they changed their Service Offering Name, and started pushing opensearch because of Elastic changing their licensing model after 7.10.

I have had to use Postman to add a repo with role_arn for all of my clusters even going back to version 1.5

@cars10
Copy link
Owner

cars10 commented Feb 16, 2024

I know the history of opensearch. But i am not able to find the option role_arn anywhere in the official elasticsearch docs, thats why i assume its opensearch only.

@gw-bcharboneau
Copy link
Author

gw-bcharboneau commented Feb 16, 2024

it is because it is a customization that AWS made to allow users to add a repo that uses S3 without making the S3 bucket Public. it has been there since version 1.5 on AWS Managed clusters only.

The IAM role_arn is used to authenticate the cluster to have access to the S3 bucket

Here is an example IAM Policy that would be attached to the role

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation",
                "s3:ListBucketMultipartUploads",
                "s3:ListBucketVersions"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject",
                "s3:AbortMultipartUpload",
                "s3:ListMultipartUploadParts"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::my-elastic-search-repo",
                "arn:aws:s3:::my-elastic-search-repo/*"
            ]
        }
    ]
}

and this is the trust policy that allows it to be used by elasticsearch

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Effect": "Allow",
            "Principal": {
                "Service": "es.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

@gw-bcharboneau
Copy link
Author

gw-bcharboneau commented Feb 16, 2024

using a role allows you to bypass storing access key and secret in the keystore as it generates temporary credentials, when the role is used

@gw-bcharboneau
Copy link
Author

this is literally all i run in postman to setup a private s3 bucket as a repo

image
image

with that i get a valid repo that i can send snapshots directly to and i do not have to store credentials anywhere

@gw-bcharboneau
Copy link
Author

gw-bcharboneau commented Feb 16, 2024

All I am asking for is an optional parameter for IAM Role Arn for AWS Managed clusters. is this something you would be willing to look into? Using a role is much more secure than an IAM User with an Access Key and Secret. I am more than happy to help test a build if it gets added.

@cars10
Copy link
Owner

cars10 commented Feb 17, 2024

I will look into this. In the meantime, you can always use the rest page to manually run queries as you do in postman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants