Adding an Or condition in an AWS JSON policy

Problem:

How do I add an Or condition in an AWS JSON policy?

Solution:

Add the policy as below, this policy allows emails to be sent from addresses like <list> Or from case insensitive emails that equal <list>.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "ses:SendRawEmail",
            "Resource": "*",
            "Condition": {
                "StringLike": {
                    "ses:FromAddress": [
                        "*.server@contoso.com",
                       "*.client02@contoso.com"
                    ]
                }
            }
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "ses:SendRawEmail",
            "Resource": "*",
            "Condition": {
                "StringEqualsIgnoreCase": {
                    "ses:FromAddress": [
                        "NOTIFICATIONS@contoso.com",
                        "CaseInsensitive@contoso.com"
                    ]
                }
            }
        }
    ]
}

Leave a Reply

Your email address will not be published. Required fields are marked *