Lambda to register manual snapshot repository

0

Hi,

Im trying to automate the deployment of opensearch as well as setting up snapshots to s3 (we want to keep backups longer than 14 days)

Im currently running the opensearch cluster in cognito mode. But not sure how to configure boto3 auth.

reference: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-snapshots.html

3개 답변
0

Hi,

Not sure what happened there, half my question got removed!

I am basing my lambda function on that code, and run the lambda via a role that has the iam:Passrole / ESHttpPut attached to it, How do i update the example script for using a role instead of a user?

Ie: update the below 2 lines to work with a role instead of user

credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)

im looking at the boto3 docs and not seeing an option, but might be in the wrong place?!

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

Any help greatly appreciated

답변함 2년 전
0

If i just create a new IAM user with the IAM:PassRole setup it errors below, which looks like it needs opensearch access (aka has to be a cognito user!) But i dont understand how i could can set up a cognito user to have the specific policy? or how i you would have to re-write that script to run via cognito user?

403
{"error":{"root_cause":[{"type":"security_exception","reason":"no permissions for [cluster:admin/repository/put] and User [name=arn:aws:iam::11111:user/manual-snapshot-reg, backend_roles=[], requestedTenant=null]"}],"type":"security_exception","reason":"no permissions for [cluster:admin/repository/put] and User [name=arn:aws:iam::11111:user/manual-snapshot-reg, backend_roles=[], requestedTenant=null]"},"status":403}
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠