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.

## Create New 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

## Secret

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

Methods

[]   clear   create   each   each_item   new   new_options  

Included Modules

Collection

Attributes

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.

Public Class methods

@param [Hash] options @option options [User] :user If present, this collection will only

  represent the access keys for the given user.

Public Instance methods

@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]

Protected Instance methods

@api private

[Validate]