Last active
August 3, 2024 14:18
-
-
Save andrewpetrochenkov/059563aab282719f3c72fc254a852964 to your computer and use it in GitHub Desktop.
AWS IAM CloudWatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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