# IAM policy example: write to one log group, with a least privilege rewrite

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Allows an application role to create log streams and put events in one CloudWatch Logs group and nothing else. The original allows logs:* on every log group. The rewrite lists two actions on one group and its streams. The names and the account ID 111122223333 are AWS documentation placeholders.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "WriteLogs",
      "Effect": "Allow",
      "Action": "logs:*",
      "Resource": "*"
    }
  ]
}
```

## What it allows

- Allows every CloudWatch Logs action on every group.

- Allows 133 actions (logs:*) on every resource.

Checks:
- high: Allows 70 write or permissions-management actions (2 permissions management) on every resource ("Resource": "*"). (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)

The action logs:* covers 133 actions, including deleting groups and changing retention.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "WriteOneGroup",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": "arn:aws:logs:us-east-1:111122223333:log-group:/app/orders:*"
    }
  ]
}
```

The rewrite lets the application write only to the /app/orders group. Deleting groups and reading other logs are removed.

- Allows 2 actions (logs:CreateLogStream, logs:PutLogEvents) on arn:aws:logs:us-east-1:111122223333:log-group:/app/orders:*.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every CloudWatch Logs action and its access level](/actions/logs/)

## Related pages

- [IAM policy example: read CloudTrail events](/examples/cloudtrail-read-recent-events/)
- [IAM policy example: send messages to one SQS queue](/examples/sqs-send-to-one-queue/)
- [IAM policy example: consume messages from one SQS queue](/examples/sqs-consume-one-queue/)
- [All of them](/examples/)

## Sources

- Amazon CloudWatch Logs User Guide: managing access: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/logs-application-write-logs/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
