-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from nalbam/main
Add MAX_THROTTLE_COUNT
- Loading branch information
Showing
8 changed files
with
326 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# aws role | ||
|
||
```bash | ||
export NAME="lambda-gurumi-ai-bot" | ||
``` | ||
|
||
## create role | ||
|
||
```bash | ||
export DESCRIPTION="${NAME} role" | ||
|
||
aws iam create-role --role-name "${NAME}" --description "${DESCRIPTION}" --assume-role-policy-document file://trust-policy.json | jq . | ||
|
||
aws iam get-role --role-name "${NAME}" | jq . | ||
``` | ||
|
||
## create policy | ||
|
||
```bash | ||
export DESCRIPTION="${NAME} policy" | ||
|
||
aws iam create-policy --policy-name "${NAME}" --policy-document file://role-policy.json | jq . | ||
|
||
export ACCOUNT_ID=$(aws sts get-caller-identity | jq .Account -r) | ||
export POLICY_ARN="arn:aws:iam::${ACCOUNT_ID}:policy/${NAME}" | ||
|
||
aws iam get-policy --policy-arn "${POLICY_ARN}" | jq . | ||
|
||
aws iam create-policy-version --policy-arn "${POLICY_ARN}" --policy-document file://role-policy.json --set-as-default | jq . | ||
``` | ||
|
||
## attach role policy | ||
|
||
```bash | ||
aws iam attach-role-policy --role-name "${NAME}" --policy-arn "${POLICY_ARN}" | ||
# aws iam attach-role-policy --role-name "${NAME}" --policy-arn "arn:aws:iam::aws:policy/PowerUserAccess" | ||
# aws iam attach-role-policy --role-name "${NAME}" --policy-arn "arn:aws:iam::aws:policy/AdministratorAccess" | ||
``` | ||
|
||
## add role-assume | ||
|
||
```yaml | ||
|
||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
role-to-assume: "arn:aws:iam::968005369378:role/lambda-gurumi-ai-bot" | ||
role-session-name: github-actions-ci-bot | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Sts GetCallerIdentity | ||
run: | | ||
aws sts get-caller-identity | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"cloudformation:ValidateTemplate" | ||
], | ||
"Resource": "*" | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"cloudformation:*" | ||
], | ||
"Resource": "arn:aws:cloudformation:*:*:stack/lambda-gurumi-ai-bot-*" | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"lambda:*" | ||
], | ||
"Resource": [ | ||
"arn:aws:lambda:*:*:function:lambda-gurumi-ai-bot-*", | ||
"arn:aws:lambda:*:*:function:gurumi-ai-bot-*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:*" | ||
], | ||
"Resource": "arn:aws:iam::*:role/lambda-gurumi-ai-bot-*" | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:*" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::lambda-gurumi-ai-bot-*", | ||
"arn:aws:s3:::gurumi-ai-bot-*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"dynamodb:*" | ||
], | ||
"Resource": [ | ||
"arn:aws:dynamodb:*:*:table/lambda-gurumi-ai-bot-*", | ||
"arn:aws:dynamodb:*:*:table/gurumi-ai-bot-*" | ||
] | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Federated": "arn:aws:iam::968005369378: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:awskrug/lambda-gurumi-ai-bot:*" | ||
} | ||
} | ||
} | ||
] | ||
} |
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
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
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
Oops, something went wrong.