0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

aws iam code

Posted at
# variables.py
role_config = {
    "lambda": {
        "trusted_role_services": ["lambda.amazonaws.com"],
        "custom_role_policy_arns": ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
    },
    "ec2": {
        "trusted_role_services": ["ec2.amazonaws.com"],
        "custom_role_policy_arns": ["arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess"]
    },
    # 添加其他角色的配置
}
# main.py
from variables import role_config
from somewhere import IamAssumableRole  # 假设IamAssumableRole是你定义的或者导入的类

for role_name, config in role_config.items():
    IamAssumableRole(
        self,
        role_name,
        trusted_role_services=config["trusted_role_services"],
        create_role=True,
        role_name=role_name,
        custom_role_policy_arns=config["custom_role_policy_arns"]
    )
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?