Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y2k2mt/aws-credentials.cr
Get AWS credentials in various ways.
https://github.com/y2k2mt/aws-credentials.cr
Last synced: about 2 months ago
JSON representation
Get AWS credentials in various ways.
- Host: GitHub
- URL: https://github.com/y2k2mt/aws-credentials.cr
- Owner: y2k2mt
- License: mit
- Created: 2019-05-22T04:07:57.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-20T08:20:28.000Z (4 months ago)
- Last Synced: 2024-05-21T01:05:02.468Z (4 months ago)
- Language: Crystal
- Size: 58.6 KB
- Stars: 3
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - aws-credentials - Get AWS credentials in various ways (Third-party APIs)
README
# aws-credentials
[![Crystal CI](https://github.com/y2k2mt/aws-credentials.cr/workflows/Crystal%20CI/badge.svg)](https://github.com/y2k2mt/aws-credentials.cr/actions)
[![Releases](https://img.shields.io/github/release/y2k2mt/aws-credentials.cr.svg?maxAge=360)](https://github.com/y2k2mt/aws-credentials.cr/releases)
Get AWS credentials in various ways.## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
aws-credentials:
github: y2k2mt/aws-credentials.cr
```2. Run `shards install`
## Usage
`Providers` resolves credentials in order from given` Provider`.
In the example below, at first ,`Providers` resolves credentials from EnvProvider ('AWS_ACCESS_KEY_ID' and 'AWS_SECRET_ACCESS_KEY' in env) and then resolves credentials from SharedCredentialFileProvider ('~/.aws/credentials').
```crystal
require "aws-credentials"include Aws::Credentials
provider = Providers.new ([
EnvProvider.new,
SharedCredentialFileProvider.new
] of Provider)credentials = provider.credentials
# Aws::Credentials::Credentials(@access_key_id="AKIA...",@expiration=nil,@secret_access_key="mVlf...",@session_token=nil)
```Current `Provider` implementation is as follows:
- [EnvProvider](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)
- [SharedCredentialFileProvider](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
- [InstanceMetadataProvider](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)
- [ContainerCredentialProvider](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html)
- [AssumeRoleProvider](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)
- Usage: Please watch `spec/it/assume_role_with_sts_spec.cr`
- SimpleCredentials (Simply holds given credentials)## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [y2k2mt](https://github.com/y2k2mt) - creator and maintainer