import json
import boto3

# Create IAM client
iam = boto3.client('iam')

# Create a policy
my_managed_policy = {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "logs:CreateLogGroup",
            "Resource": "RESOURCE_ARN"
        },
        {
            "Effect": "Allow",
            "Action": [
                "dynamodb:DeleteItem",
                "dynamodb:GetItem",
                "dynamodb:PutItem",
                "dynamodb:Scan",
                "dynamodb:UpdateItem"
            ],
            "Resource": "RESOURCE_ARN"
        }
    ]
}
response = iam.create_policy(
  PolicyName='myDynamoDBPolicy',
  PolicyDocument=json.dumps(my_managed_policy)
)
print(response)
9c2706a31f293d51ba24e89e46dc8e4bb996c0d6
<mask token>

<mask token>
print(response)

<mask token>
iam = boto3.client('iam')
my_managed_policy = {'Version': '2012-10-17', 'Statement': [{'Effect':
    'Allow', 'Action': 'logs:CreateLogGroup', 'Resource': 'RESOURCE_ARN'},
    {'Effect': 'Allow', 'Action': ['dynamodb:DeleteItem',
    'dynamodb:GetItem', 'dynamodb:PutItem', 'dynamodb:Scan',
    'dynamodb:UpdateItem'], 'Resource': 'RESOURCE_ARN'}]}
response = iam.create_policy(PolicyName='myDynamoDBPolicy', PolicyDocument=
    json.dumps(my_managed_policy))
print(response)

import json
import boto3
iam = boto3.client('iam')
my_managed_policy = {'Version': '2012-10-17', 'Statement': [{'Effect':
    'Allow', 'Action': 'logs:CreateLogGroup', 'Resource': 'RESOURCE_ARN'},
    {'Effect': 'Allow', 'Action': ['dynamodb:DeleteItem',
    'dynamodb:GetItem', 'dynamodb:PutItem', 'dynamodb:Scan',
    'dynamodb:UpdateItem'], 'Resource': 'RESOURCE_ARN'}]}
response = iam.create_policy(PolicyName='myDynamoDBPolicy', PolicyDocument=
    json.dumps(my_managed_policy))
print(response)

import json
import boto3

# Create IAM client
iam = boto3.client('iam')

# Create a policy
my_managed_policy = {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "logs:CreateLogGroup",
            "Resource": "RESOURCE_ARN"
        },
        {
            "Effect": "Allow",
            "Action": [
                "dynamodb:DeleteItem",
                "dynamodb:GetItem",
                "dynamodb:PutItem",
                "dynamodb:Scan",
                "dynamodb:UpdateItem"
            ],
            "Resource": "RESOURCE_ARN"
        }
    ]
}
response = iam.create_policy(
  PolicyName='myDynamoDBPolicy',
  PolicyDocument=json.dumps(my_managed_policy)
)
print(response)