Giter Club home page Giter Club logo

rotate-iam-keys's Introduction

Rotating IAM Access keys with Lambda

This AWS Lambda function deletes Access Keys from specified IAM groups periodically. I wrote about why this is useful here: https://medium.com/@dvdtoth/rotating-iam-access-keys-with-lambda-c86223ffb381

Read more about IAM best practices here: https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html

Deploy the function

You have two options to deploy with: Terraform or Serverless. You will need to set two variables, the name of the IAM groups and the schedule.

By default the trigger is set to run every Friday at 23:55. For schedule expression check https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html

Deploying with Terraform

Update variables in production.tfvars

zip revoke_keys.zip handler.js
terraform init
terraform apply -var-file="production.tfvars"

To remove:

terraform destroy -var-file="production.tfvars"

Deploying with Serverless

Update GROUPS env var and the schedule as needed in serverless.yml.

serverless deploy --aws-profile yourprofile

To remove:

serverless remove --aws-profile yourprofile

rotate-iam-keys's People

Contributors

dvdtoth avatar filipponova avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.