Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ssm policy statement #6

Merged
merged 2 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/aibs_informatics_cdk_lib/common/aws/iam_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@

SNS_FULL_ACCESS_ACTIONS = ["sns:*"]

SSM_READ_ACTIONS = [
"ssm:GetParameter",
"ssm:GetParameters",
"ssm:GetParametersByPath",
]


def batch_policy_statement(
env_base: Optional[EnvBase] = None,
Expand Down Expand Up @@ -229,7 +235,7 @@ def s3_policy_statement(
)


def ses_policty_statement(
def ses_policy_statement(
actions: List[str] = SES_FULL_ACCESS_ACTIONS,
sid: str = "SESFullAccess",
) -> iam.PolicyStatement:
Expand Down Expand Up @@ -263,7 +269,7 @@ def sfn_policy_statement(
)


def sns_policty_statement(
def sns_policy_statement(
actions: List[str] = SNS_FULL_ACCESS_ACTIONS,
sid: str = "SNSFullAccess",
) -> iam.PolicyStatement:
Expand All @@ -279,6 +285,14 @@ def sns_policty_statement(
)


def ssm_policy_statement(
actions: List[str] = SSM_READ_ACTIONS, sid: str = "SSMParamReadActions"
) -> iam.PolicyStatement:
return iam.PolicyStatement(
sid=sid, actions=actions, effect=iam.Effect.ALLOW, resources=[build_arn(service="ssm")]
)


def grant_managed_policies(
role: Optional[iam.IRole],
*managed_policies: Union[str, iam.ManagedPolicy],
Expand Down
Loading