Skip to content

Commit

Permalink
add example of get-federation-token
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Jul 5, 2021
1 parent 211d7c2 commit e18941f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output
16 changes: 16 additions & 0 deletions scripts/get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash -e

aws sts get-federation-token --name mantil-proj1 --duration-seconds 900 --policy "$(jq -c . policy.json)" --no-cli-pager > output
cat output

export AWS_ACCESS_KEY_ID="$(jq -r .Credentials.AccessKeyId output)"
export AWS_SECRET_ACCESS_KEY="$(jq -r .Credentials.SecretAccessKey output)"
export AWS_SESSION_TOKEN="$(jq -r .Credentials.SessionToken output)"

name=hello
build_name=hello:v016b704-dirty.zip
aws lambda update-function-code --no-cli-pager \
--function-name "proj1-try-mantil-team-$name" \
--s3-bucket try.mantil.team-lambda-functions \
--s3-key "functions/$build_name" \
--publish
26 changes: 26 additions & 0 deletions scripts/policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:*"
],
"Resource": "arn:aws:lambda:*:*:function:proj1-try-mantil-team-*"
},
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": "arn:aws:s3:::try.mantil.team-lambda-functions*"
},
{
"Effect": "Allow",
"Action": [
"apigateway:*"
],
"Resource": "arn:aws:apigateway:*:proj1-try-mantil-team"
}
]
}

0 comments on commit e18941f

Please sign in to comment.