aws iam create-open-id-connect-provider --url "https://token.actions.githubusercontent.com" --client-id-list "sts.amazonaws.com"
aws iam create-open-id-connect-provider --url "https://token.actions.githubusercontent.com" --client-id-list "sts.amazonaws.com"
aws iam create-open-id-connect-provider --url "https://token.actions.githubusercontent.com" --client-id-list "sts.amazonaws.com"
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "cloudwatch:PutDashboard", "Resource": "arn:aws:cloudwatch::ADD_YOUR_AWS_ACCOUNT_ID:dashboard/*" } ]
}
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "cloudwatch:PutDashboard", "Resource": "arn:aws:cloudwatch::ADD_YOUR_AWS_ACCOUNT_ID:dashboard/*" } ]
}
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "cloudwatch:PutDashboard", "Resource": "arn:aws:cloudwatch::ADD_YOUR_AWS_ACCOUNT_ID:dashboard/*" } ]
}
aws iam create-policy --policy-name policyForGithubAction --policy-document file://policyForGithubAction.json --description "A custom policy to grant permissions to put CloudWatch dashboards"
aws iam create-policy --policy-name policyForGithubAction --policy-document file://policyForGithubAction.json --description "A custom policy to grant permissions to put CloudWatch dashboards"
aws iam create-policy --policy-name policyForGithubAction --policy-document file://policyForGithubAction.json --description "A custom policy to grant permissions to put CloudWatch dashboards"
# This command is wrong. The value of the --policy-document parameter is invalid
aws iam create-policy --policy-name policyForGithubAction --policy-document file://home/username/dev/my-project/policyForGithubAction.json --description "A custom policy to grant permissions to put CloudWatch dashboards"
# This command is wrong. The value of the --policy-document parameter is invalid
aws iam create-policy --policy-name policyForGithubAction --policy-document file://home/username/dev/my-project/policyForGithubAction.json --description "A custom policy to grant permissions to put CloudWatch dashboards"
# This command is wrong. The value of the --policy-document parameter is invalid
aws iam create-policy --policy-name policyForGithubAction --policy-document file://home/username/dev/my-project/policyForGithubAction.json --description "A custom policy to grant permissions to put CloudWatch dashboards"
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::ADD_YOUR_AWS_ACCOUNT_ID:oidc-provider/token.actions.githubusercontent.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" }, "StringLike": { "token.actions.githubusercontent.com:sub": [ "repo:ADD_USERNAME_OR_ORGANIZATION_GITHUB_NAME/ADD_YOUR_REPOSITORY_NAME:*" ] } } } ]
}
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::ADD_YOUR_AWS_ACCOUNT_ID:oidc-provider/token.actions.githubusercontent.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" }, "StringLike": { "token.actions.githubusercontent.com:sub": [ "repo:ADD_USERNAME_OR_ORGANIZATION_GITHUB_NAME/ADD_YOUR_REPOSITORY_NAME:*" ] } } } ]
}
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::ADD_YOUR_AWS_ACCOUNT_ID:oidc-provider/token.actions.githubusercontent.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" }, "StringLike": { "token.actions.githubusercontent.com:sub": [ "repo:ADD_USERNAME_OR_ORGANIZATION_GITHUB_NAME/ADD_YOUR_REPOSITORY_NAME:*" ] } } } ]
}
# Create a new IAM Role
aws iam create-role --role-name assumeRoleForGithubAction --assume-role-policy-document file://trustPolicyRoleForGithubAction.json # Attach the IAM Policy to the Role
aws iam attach-role-policy --role-name assumeRoleForGithubAction --policy-arn arn:aws:iam::ADD_YOUR_AWS_ACCOUNT_ID:policy/policyForGithubAction
# Create a new IAM Role
aws iam create-role --role-name assumeRoleForGithubAction --assume-role-policy-document file://trustPolicyRoleForGithubAction.json # Attach the IAM Policy to the Role
aws iam attach-role-policy --role-name assumeRoleForGithubAction --policy-arn arn:aws:iam::ADD_YOUR_AWS_ACCOUNT_ID:policy/policyForGithubAction
# Create a new IAM Role
aws iam create-role --role-name assumeRoleForGithubAction --assume-role-policy-document file://trustPolicyRoleForGithubAction.json # Attach the IAM Policy to the Role
aws iam attach-role-policy --role-name assumeRoleForGithubAction --policy-arn arn:aws:iam::ADD_YOUR_AWS_ACCOUNT_ID:policy/policyForGithubAction
# File location: .github/workflows/action.yml
name: Connect to an AWS role from a GitHub repository and install the action to create dashboards in CloudWatch # Execute the action when a user opens a new issue
on: issues: types: [opened] # Change the region to your current region
env: AWS_REGION: "us-east-1" permissions: id-token: write contents: read jobs: AssumeRoleAndCallIdentity: runs-on: ubuntu-latest steps: # This code snippet is used to connect GitHub to your AWS Account - name: configure aws credentials uses: aws-actions/[email protected] with: role-to-assume: arn:aws:iam::ADD_AWS_ID:role/to_enable_creating_dashboards role-session-name: GitHub_to_AWS_via_FederatedOIDC aws-region: ${{ env.AWS_REGION }} # Action to create the dashboard - name: create dash uses: "JonasBarros1998/automate-dashboards@latest"
# File location: .github/workflows/action.yml
name: Connect to an AWS role from a GitHub repository and install the action to create dashboards in CloudWatch # Execute the action when a user opens a new issue
on: issues: types: [opened] # Change the region to your current region
env: AWS_REGION: "us-east-1" permissions: id-token: write contents: read jobs: AssumeRoleAndCallIdentity: runs-on: ubuntu-latest steps: # This code snippet is used to connect GitHub to your AWS Account - name: configure aws credentials uses: aws-actions/[email protected] with: role-to-assume: arn:aws:iam::ADD_AWS_ID:role/to_enable_creating_dashboards role-session-name: GitHub_to_AWS_via_FederatedOIDC aws-region: ${{ env.AWS_REGION }} # Action to create the dashboard - name: create dash uses: "JonasBarros1998/automate-dashboards@latest"
# File location: .github/workflows/action.yml
name: Connect to an AWS role from a GitHub repository and install the action to create dashboards in CloudWatch # Execute the action when a user opens a new issue
on: issues: types: [opened] # Change the region to your current region
env: AWS_REGION: "us-east-1" permissions: id-token: write contents: read jobs: AssumeRoleAndCallIdentity: runs-on: ubuntu-latest steps: # This code snippet is used to connect GitHub to your AWS Account - name: configure aws credentials uses: aws-actions/[email protected] with: role-to-assume: arn:aws:iam::ADD_AWS_ID:role/to_enable_creating_dashboards role-session-name: GitHub_to_AWS_via_FederatedOIDC aws-region: ${{ env.AWS_REGION }} # Action to create the dashboard - name: create dash uses: "JonasBarros1998/automate-dashboards@latest"
{ "title": "dashboard-services", "region": "us-east-1", "services": [ { "enable": true, "serviceName": "my-bucket-s3", "serviceType": "S3" }, { "enable": true, "serviceName": "my-sqs-queue", "serviceType": "SQS" }, { "enable": true, "serviceName": "my-topic-dashboards", "serviceType": "SNS" }, { "enable": true, "serviceName": "change-data-capture", "serviceType": "Lambda" } ]
}
{ "title": "dashboard-services", "region": "us-east-1", "services": [ { "enable": true, "serviceName": "my-bucket-s3", "serviceType": "S3" }, { "enable": true, "serviceName": "my-sqs-queue", "serviceType": "SQS" }, { "enable": true, "serviceName": "my-topic-dashboards", "serviceType": "SNS" }, { "enable": true, "serviceName": "change-data-capture", "serviceType": "Lambda" } ]
}
{ "title": "dashboard-services", "region": "us-east-1", "services": [ { "enable": true, "serviceName": "my-bucket-s3", "serviceType": "S3" }, { "enable": true, "serviceName": "my-sqs-queue", "serviceType": "SQS" }, { "enable": true, "serviceName": "my-topic-dashboards", "serviceType": "SNS" }, { "enable": true, "serviceName": "change-data-capture", "serviceType": "Lambda" } ]
} - Your project must use GitHub Actions.
- Your user must have permissions to create an OpenID Connect IDP, policies, and roles in your AWS account.
- AWS CLI installed on your computer to make it easier to create IAM policies, roles, and a new IDP to connect to the GitHub account