Class | AWS::IAM::AccessKeyCollection |
In: |
lib/aws/iam/access_key_collection.rb
|
Parent: | Object |
Both AWS accounts and IAM users can have access keys (maximum of 2). You can create new keys so that you can rotate out your old keys. You can create, delete, activate and deactivate access keys.
# for the aws account access_keys = iam.access_keys.create # for an iam user user_access_keys = iam.users['johndoe'].access_keys.create
Make sure after creating an access to retrieve the secret access key and save it somewhere safe.
access_keys = iam.access_keys.create secret = access_keys.secret
If you try to access the secret on an access key that was not newly created an error will be raised. AWS will only give the secret for a newly created access key:
access_keys = iam.access_keys.first access_keys.secret #=> oops, raises a runtime error
user | [R] |
@return [User,nil] Returns the user these accesss
keys belong to.
If this returns +nil+ then these access keys belong to the AWS account. |
@param [Hash] options @option options [User] :user If present, this collection will only
represent the access keys for the given user.
@param [String] access_key_id The ID of the access key. @return [AccessKey] Returns a reference to the access key with
the given +access_key_id+.
Deletes all of the access keys from this collection.
iam.users['someuser'].access_keys.clear
@return [nil]
Yields once for each access key. You can limit the number of access keys yielded using +:limit+.
@param [Hash] options @option options [Integer] :limit The maximum number of access keys
to yield.
@option options [Integer] :batch_size The maximum number of
access keys received each service reqeust.
@yieldparam [AccessKey] access_key @return [nil]