Giter Site home page Giter Site logo

xargsuk / switchroles-lambda Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 49 KB

Automatically generate your AWS account configurations through AWS Organizations

License: MIT License

Python 100.00%
aws config generator lambda organizations roles switch aesr

switchroles-lambda's Introduction

Switch Roles Lambda

Automatically generate your AWS account configurations through AWS Organizations

Python GitHub%20Actions


Quick Links


Overview

The switchroles-lambda project leverages AWS Lambda to streamline the generation of AWS configurations for accounts in Organizations. It provides a flexible and scalable solution for managing AWS resources across multiple accounts and regions. It is designed with AWS Extend Switch Roles and AESR S3 Config Sender in mind.


Getting Started

Requirements

Ensure you have the following dependencies installed on your system:

  • Python: version 3.10.12
  • boto3: version 1.34.43

Installation

  1. Clone the switchroles-lambda repository:
git clone [email protected]:XargsUK/switchroles-lambda.git
  1. Change to the project directory:
cd switchroles-lambda
  1. Install the dependencies:
pip install -r requirements.txt

Running switchroles-lambda

This python script can be run locally or deployed as an AWS Lambda function.

Name Description Example
S3_BUCKET The name of the S3 bucket where the configurations will be stored (if not running locally). awsconfigs-bucket
ASSUME_ROLE The role name to be assumed in each payer account. AccountSwitcherLambdaRole
ROLE_NAMES Comma-separated role names for which the configurations will be generated. Admin,Developer,ReadOnly
SESSION_NAME The session name to use when assuming roles. RoleSwitcherLambdav2
PAYER_ACCOUNT_IDS Comma-separated AWS payer account IDs. 123456789012,210987654321
OU_OVERRIDES JSON string of organizational unit (OU) ID to name mappings for overrides. {"ou-xyz1-abcdefgh":"Engineering","ou-xyz2-abcdefgh":"Marketing"}
running_locally Set true for Local execution, false for Lambda. true
AWS_REGION The AWS region to use for the Lambda function. us-west-2
AWS_PROFILE The AWS profile to use for the Lambda function. default

Local Execution

Start by setting your environment variables:

export running_locally=true
export S3_BUCKET=S3_BUCKET_NAME
...

Once you've set your environment variables the following command to run switchroles-lambda:

python lambda_handler.py

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines

  1. Fork the Repository: Start by forking the project repository to your local account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone `repo_url`
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


License

This project is protected under the MIT License.


switchroles-lambda's People

Contributors

xargsuk avatar

Watchers

 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.