跳至內容

AWS Console error: "Failed to get the secret value" when pressing 'Retrieve Secret Value'

0

I get error "Failed to get the secret value" when pressing 'Retrieve Secret Value'
Retrieve Secret Value

I am not an IAM user with a role, but logged in as an IAM-identity-center user.

My group has a permission-set containing the AWS-managed policy SecretsManagerReadWrite.

The resource policy of the secret is set to deny all requests not coming from a specified VPCE (e.g. vpce-myvpce) as follows:

{
  "Version" : "2012-10-17",
  "Id" : "pl-sm_ev_vpce_ecs_sr",
  "Statement" : [ {
    "Sid" : "RestrictGetSecretValueoperation",
    "Effect" : "Deny",
    "Principal" : "*",
    "Action" : "secretsmanager:GetSecretValue",
    "Resource" : "*",
    "Condition" : {
      "StringNotEquals" : {
        "aws:sourceVpce" : "vpce-myvpce"
      }
    }
  } ]
}

How should I modify this policy in order to allow myself access to my secrets via the AWS Console, i.e. view and edit the key/value pairs?

已提問 10 個月前檢視次數 604 次
1 個回答
1
已接受的答案

Hello.

How about setting the IAM role used by IAM-identity-center in the same account as SecretsManager as an exception, as shown below?

{
  "Version" : "2012-10-17",
  "Id" : "pl-sm_ev_vpce_ecs_sr",
  "Statement" : [ {
    "Sid" : "RestrictGetSecretValueoperation",
    "Effect" : "Deny",
    "Principal" : "*",
    "Action" : "secretsmanager:GetSecretValue",
    "Resource" : "*",
    "Condition" : {
      "StringNotEquals" : {
        "aws:sourceVpce" : "vpce-myvpce",
        "aws:PrincipalArn" : [ 
          "arn:aws:iam::your-account-id:role/aws-reserved/sso.amazonaws.com/your-iam-identity-center-region/AWSReservedSSO_Role"
        ]
      }
    }
  } ]
}
專家
已回答 10 個月前
專家
已審閱 10 個月前
  • In your answer, I further had to replace /AWSReservedSSO_Role with the 'Federated user' id copied from the account details in the top-right corner of the console, e.g. /AWSReservedSSO_PermissionSetName_somecode

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。