public_access_block#

State module for managing AWS S3 bucket public access block.

async idem_aws.states.aws.s3.public_access_block.present(hub, ctx, name: str, bucket: str, public_access_block_configuration: PublicAccessBlockConfiguration, expected_bucket_owner: str = None, resource_id: str = None) Dict[str, Any][source]#

Creates or modifies the PublicAccessBlock configuration for an Amazon S3 bucket.

To use this operation, the calling entity must have the s3:PutBucketPublicAccessBlock permission.

Parameters:
  • name (str) – The name of the bucket public access block configuration.

  • bucket (str) – Bucket name to identify the resource

  • public_access_block_configuration (dict[str, Any]) –

    The PublicAccessBlock configuration that you want to apply to this Amazon S3 bucket. You can enable the configuration options in any combination. For more information about when Amazon S3 considers a bucket or object public, see The Meaning of “Public” in the Amazon S3 User Guide.

    • BlockPublicAcls (bool, Optional):

      Specifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and objects in this bucket. Setting this element to TRUE causes the following behavior: PUT Bucket ACL and PUT Object ACL calls fail if the specified ACL is public. PUT Object calls fail if the request includes a public ACL. PUT Bucket calls fail if the request includes a public ACL. Enabling this setting doesn’t affect existing policies or ACLs.

    • IgnorePublicAcls (bool, Optional):

      Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket. Setting this element to TRUE causes Amazon S3 to ignore all public ACLs on this bucket and objects in this bucket. Enabling this setting doesn’t affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set.

    • BlockPublicPolicy (bool, Optional):

      Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access. Enabling this setting doesn’t affect existing bucket policies.

    • RestrictPublicBuckets (bool, Optional):

      Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to TRUE restricts access to this bucket to only Amazon Web Service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn’t affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.

  • expected_bucket_owner (str, Optional) – The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • resource_id (str, Optional) – Bucket name to identify the resource

Request Syntax:
resource_name:
  aws.s3.public_access_block.present:
    - name: string
    - bucket: string
    - public_access_block_configuration: dict
    - expected_bucket_owner: string
    - resource_id: string
Returns:

dict[str, Any]

Examples


test-bucket-1232323-public-access-block:
aws.s3.public_access_block.present:
  • name: test-bucket-1232323-public-access-block

  • bucket: test-bucket-1232323

  • public_access_block_configuration: {“BlockPublicAcls”: true, “IgnorePublicAcls”: true,

    “BlockPublicPolicy”: true, “RestrictPublicBuckets”: true }

  • expected_bucket_owner: 1234567890

  • resource_id: test-bucket-1232323

async idem_aws.states.aws.s3.public_access_block.absent(hub, ctx, name: str, resource_id: str = None, expected_bucket_owner: str = None) Dict[str, Any][source]#

Removes the PublicAccessBlock configuration for an Amazon S3 bucket.

To use this operation, you must have the s3:PutBucketPublicAccessBlock permission.

Parameters:
  • name (str) – The name of public block configuration

  • resource_id (str, Optional) – Bucket name to identify the resource

  • expected_bucket_owner (str, Optional) – The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Returns:

dict[str, Any]

Request Syntax:
resource_name:
  aws.s3.public_access_block.absent:
    - name: string
    - resource_id: string
    - expected_bucket_owner: string

Examples

test-bucket-1232323-public-access-block:
  aws.s3.public_access_block.absent:
  - name: test-bucket-1232323-public-access-block
  - resource_id: test-bucket-1232323
  - expected_bucket_owner: 1234567890
async idem_aws.states.aws.s3.public_access_block.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Obtain S3 public access block configuration for each bucket under the given context for any user.

Returns:

dict[str, Any]

Examples

$ idem describe aws.s3.public_access_block