Giter Club home page Giter Club logo

Comments (6)

garnaat avatar garnaat commented on July 29, 2024

Yeah, that's actually a good idea. Could do the same for function configuration. Then, if we can eliminate the need for caching the zip file checksum locally we could eliminate the local cache completely which would be a very good thing.

from kappa.

garnaat avatar garnaat commented on July 29, 2024

So, maybe I'm missing it but is there an IAM API request that will return the policy document associated with a Managed Policy or a version of a Managed Policy?

from kappa.

benkehoe avatar benkehoe commented on July 29, 2024

It's GetPolicy, the arn is like "arn:aws:iam::aws:policy/AWSLambdaFullAccess"

from kappa.

garnaat avatar garnaat commented on July 29, 2024

It's actually GetPolicyVersion, I think. It doesn't preserve the original form so you have to do a more intelligent diff then just doing a string compare.

from kappa.

benkehoe avatar benkehoe commented on July 29, 2024

Ah I see, I didn't look hard enough (i.e. at all) at the output of aws-cli, just that it completed without errors.

from kappa.

josegonzalez avatar josegonzalez commented on July 29, 2024

The following is POC code to get the current policy document. You'll still need to compare each statement, but that should be relatively easy?

import boto3

client = boto3.client('iam')

policy_arn = 'arn:aws:iam::093535234988:policy/kappa/{0}_{1}'.format(app_name, app_env)
response = client.get_policy(
    PolicyArn=policy_arn
)
version_id = response.get('Policy', {}).get('DefaultVersionId', None)
if version_id is None:
    raise Exception('Failed to get policy')

response = client.get_policy_version(
    PolicyArn=policy_arn,
    VersionId=version_id
)
document = response.get('PolicyVersion', {}).get('Document', None)
if document is None:
    raise Exception('Failed to get current policy document')

# compare the version here

No idea what the policy is around error handling, so feel free to substitute that here.

from kappa.

Related Issues (20)

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.