https://github.com/ozaaar/aws-go-console
A utility package to get short time AWS console access for custom identity broken entity.
https://github.com/ozaaar/aws-go-console
aws aws-console aws-iam golang golang-package sign
Last synced: 7 months ago
JSON representation
A utility package to get short time AWS console access for custom identity broken entity.
- Host: GitHub
- URL: https://github.com/ozaaar/aws-go-console
- Owner: ozaaar
- License: apache-2.0
- Created: 2021-03-29T12:03:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-18T11:52:53.000Z (about 5 years ago)
- Last Synced: 2024-06-20T13:31:17.861Z (about 2 years ago)
- Topics: aws, aws-console, aws-iam, golang, golang-package, sign
- Language: Go
- Homepage:
- Size: 632 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/ozaaar/aws-go-console)
[](https://pkg.go.dev/github.com/ozaaar/aws-go-console)
# aws-go-console
A helper package provides short-lived (scoped based) token/url for AWS console. It is based on the [documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) provided by AWS.
Package `console` have following use cases:
- Give federated access to a user via AWS Management Console without an IAM User.
- Allow users who sign in to your organization's network securely access the AWS Management Console.
## example
In following [example](example/example.go) we get sign-in url with read-only access to Elastic Container Registry (ECR) via AWS console:
```
// create AWS session using one of credentials provider e.g env variables
sess, _ := session.NewSession()
// create console and get a token with ECR read-only scope
con := console.New(sess)
token, _ := con.SignInTokenWithArn("example", "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly")
// create a url with ECR as destination which can be opened in browser directly
url, _ := token.SignInURL("https://console.aws.amazon.com/ecr")
```
with running example as follows:
[](https://www.youtube.com/watch?v=0wdf8jhNhDE)