IAM policy to issue certificate for a specific sub domain name

0

I want to create IAM policy that allows the request of ACM certificate with only a specific sub domain

"Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "acm:RequestCertificate"
        ],
        "Resource": "*",  # ACM certificate resources typically use wildcards
        "Condition": {
          "StringLike": {
            "acm:DomainNames": ["*.abc.com"]  # Allow only subdomains of abc.com
          }
        }
      }
    ]

when I request a private certificate with domain name test.abc.com using a role with the policy above, I get error with no identity based policy allows the acm:RequestCertificate

Youez
질문됨 한 달 전178회 조회
3개 답변
3

Hi,

To allow the request of an ACM certificate for a specific subdomain using an IAM policy, you need to ensure that the IAM entity (user or role) making the request has the necessary permissions. You only want to permit requests for certificates for the subdomain in this case. test.abc.com

Here IAM policy that allows requesting ACM certificates only for the test.abc.com subdomain.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "acm:RequestCertificate", "Resource": "", "Condition": { "StringLike": { "acm:DomainValidationOptions[0].DomainName": ".test.abc.com" } } } ] }

Explanation:

Effect: Allow Action: acm:RequestCertificate allows the entity to request certificates. Resource: * allows the action on all ACM resources. Condition: This condition limits the action to only certificates where the domain name matches *.test.abc.com. The DomainValidationOptions[0].DomainName condition key ensures that the certificate is requested for the specified domain.

Attach this policy to the IAM user or role that you are using to request the ACM certificate. In addition, ensure that the IAM entity has the necessary permissions to carry out the necessary actions.

답변함 한 달 전
2
수락된 답변

Hi,

It looks like you may just be missing ForAllValues: from your policy before the text StringLike. Since DomainNames is a list input parameter, it will need that above prefix for multi-valued context keys as mentioned here

Thanks

profile pictureAWS
전문가
AWS-SUM
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
profile picture
전문가
검토됨 한 달 전
  • You are right thanks

  • most welcome.

1

To achieve your goal of allowing the request of ACM certificates only for a specific subdomain, you need to approach it differently. You can create a policy that allows requesting any certificate.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "acm:RequestCertificate", "Resource": "", "Condition": { "StringLike": { "acm:DomainValidationOptions[0].ResourceRecord.Name": ".abc.com" } } } ] }

Note When you request a wild-card certificate, the asterisk (*) must be in the leftmost position of the domain name and can protect only one subdomain level. For example, *.example.com can protect login.example.com, and test.example.com, but it cannot protect test.login.example.com. Also note that *.example.com protects only the subdomains of example.com, it does not protect the bare or apex domain (example.com).

The use of the acm:DomainValidationOptions[0].DomainName context key in the condition is related to multi-context keys because it's accessing a specific attribute (DomainName) within an array (DomainValidationOptions) within the ACM service.

sandeep
답변함 한 달 전

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

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

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

관련 콘텐츠