Skip to content

Instantly share code, notes, and snippets.

@andrewpetrochenkov
Last active August 3, 2024 14:18
Show Gist options
  • Save andrewpetrochenkov/059563aab282719f3c72fc254a852964 to your computer and use it in GitHub Desktop.
Save andrewpetrochenkov/059563aab282719f3c72fc254a852964 to your computer and use it in GitHub Desktop.
AWS IAM CloudWatch
# IAM -> Users -> User -> Permissions -> Add Permissions -> attach existing policies directly
# IAM -> Users -> User -> Permissions -> Security credentials -> Create access key
USER_NAME="cloudwatch-user"
POLICY="CloudWatchFullAccess"
aws iam list-users | grep -q $(USER_NAME) || aws iam create-user --user-name $(USER_NAME);:
aws iam list-attached-user-policies --user-name $(USER_NAME) | grep -q $(POLICY) || aws iam attach-user-policy --policy-arn arn:aws:iam::aws:policy/$(POLICY) --user-name $(USER_NAME);:
aws iam list-access-keys --user-name $(USER_NAME) | grep -q AccessKeyId || aws iam create-access-key --user-name $(USER_NAME);:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment