aws-credentials
Version, currently 0.7.08 versions
github.com/y2k2mt/aws-credentials.cr
Get AWS credentials in various ways.
6 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
aws-credentials:
github: y2k2mt/aws-credentials.cr
version: ~> 0.7.0Then run:
shards installshard.yml
- Crystal
~> 1- License
- MIT
- Author
- y2k2mt <y2.k2mt@gmail.com>
Dependencies
Development Dependencies
- ameba~> 1.4github: crystal-ameba/amebadev
- awscr-signer~> 0.8github: taylorfinnell/awscr-signerdev
README
# aws-credentials
[](https://github.com/y2k2mt/aws-credentials.cr/actions)
[](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`
- [AssumeRoleWithWebIdentityProvider](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html)
- Usage: Please watch `spec/it/assume_role_with_sts_spec.cr`
- SimpleCredentials (Simply holds given credentials)
## Contributing
1. Fork it (<https://github.com/y2k2mt/aws-credentials/fork>)
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
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.7.0- Tagged
- Mar 10, 2025
- Commit
8b1853609c06- Crystal
~> 1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/y2k2mt/aws-credentials.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 8