Skip to content

AWS::S3::BucketPolicy

Applies an Amazon S3 bucket policy to an Amazon S3 bucket.

Generated by cfn-typegen --out cfn_types AWS::S3::BucketPolicy into cfn_types/s3.py:

# Generated by cfn-typegen from the CloudFormation registry schemas. Do not edit.
# fmt: off
# ruff: noqa
"""AWS::S3 resources."""

from collections.abc import Mapping
from typing import Any, Literal, Unpack
from typing_extensions import TypedDict
from cfn_typed.base import DeletionPolicy, DependsOn, ResourceAttrs, UpdateReplacePolicy, build
from cfn_typed.intrinsics import Expr


CONSTRAINTS:dict[str,Any]={
}


ATTRIBUTES:dict[str,Any]={"AWS::S3::BucketPolicy":["Bucket"]}


RULES:dict[str,Any]={}
Nested types (3)

These are defined above the properties in the generated module.

class BucketPolicyProps(TypedDict, closed=True):
    'Applies an Amazon S3 bucket policy to an Amazon S3 bucket.'
    Bucket: Expr[str]
    'The name of the Amazon S3 bucket to which the policy applies.'
    PolicyDocument: Expr[Mapping[str, Any]] | Expr[str]
    'A policy document containing permissions to add to the specified bucket.'


class BucketPolicy(ResourceAttrs):
    'Applies an Amazon S3 bucket policy to an Amazon S3 bucket.'
    Type: Literal['AWS::S3::BucketPolicy']
    Properties: BucketPolicyProps


def bucket_policy(
    *,
    depends_on: DependsOn | None = None,
    deletion_policy: DeletionPolicy | None = None,
    update_replace_policy: UpdateReplacePolicy | None = None,
    condition: str | None = None,
    metadata: dict[str, Any] | None = None,
    **props: Unpack[BucketPolicyProps],
) -> BucketPolicy:
    return build('AWS::S3::BucketPolicy', props, depends_on, deletion_policy, update_replace_policy, condition, metadata)