aws-cdk-lib 2.158.0__py3-none-any.whl → 2.159.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aws-cdk-lib might be problematic. Click here for more details.
- aws_cdk/__init__.py +36 -19
- aws_cdk/_jsii/__init__.py +1 -1
- aws_cdk/_jsii/{aws-cdk-lib@2.158.0.jsii.tgz → aws-cdk-lib@2.159.0.jsii.tgz} +0 -0
- aws_cdk/aws_amplify/__init__.py +22 -8
- aws_cdk/aws_apigatewayv2/__init__.py +30 -0
- aws_cdk/aws_appconfig/__init__.py +3 -3
- aws_cdk/aws_applicationinsights/__init__.py +544 -4
- aws_cdk/aws_applicationsignals/__init__.py +170 -142
- aws_cdk/aws_athena/__init__.py +15 -15
- aws_cdk/aws_auditmanager/__init__.py +5 -5
- aws_cdk/aws_bedrock/__init__.py +7 -7
- aws_cdk/aws_codebuild/__init__.py +39 -18
- aws_cdk/aws_codeconnections/__init__.py +1 -1
- aws_cdk/aws_cognito/__init__.py +390 -203
- aws_cdk/aws_connect/__init__.py +1679 -152
- aws_cdk/aws_datazone/__init__.py +665 -40
- aws_cdk/aws_docdb/__init__.py +6 -1
- aws_cdk/aws_dynamodb/__init__.py +5 -5
- aws_cdk/aws_ec2/__init__.py +121 -36
- aws_cdk/aws_ecr/__init__.py +14 -6
- aws_cdk/aws_ecs/__init__.py +20 -20
- aws_cdk/aws_elasticloadbalancingv2/__init__.py +167 -20
- aws_cdk/aws_emr/__init__.py +8 -8
- aws_cdk/aws_events/__init__.py +19 -17
- aws_cdk/aws_events_targets/__init__.py +165 -85
- aws_cdk/aws_fms/__init__.py +59 -0
- aws_cdk/aws_fsx/__init__.py +3 -3
- aws_cdk/aws_gamelift/__init__.py +40 -52
- aws_cdk/aws_globalaccelerator/__init__.py +22 -29
- aws_cdk/aws_iam/__init__.py +22 -20
- aws_cdk/aws_iotfleetwise/__init__.py +419 -0
- aws_cdk/aws_iotsitewise/__init__.py +90 -1
- aws_cdk/aws_iotwireless/__init__.py +205 -0
- aws_cdk/aws_lambda/__init__.py +129 -16
- aws_cdk/aws_lex/__init__.py +15 -1
- aws_cdk/aws_logs/__init__.py +1 -1
- aws_cdk/aws_mediaconnect/__init__.py +111 -0
- aws_cdk/aws_medialive/__init__.py +7988 -3262
- aws_cdk/aws_msk/__init__.py +287 -479
- aws_cdk/aws_opensearchservice/__init__.py +6 -0
- aws_cdk/aws_pcaconnectorscep/__init__.py +69 -30
- aws_cdk/aws_pipes/__init__.py +49 -0
- aws_cdk/aws_qbusiness/__init__.py +11 -14
- aws_cdk/aws_quicksight/__init__.py +638 -99
- aws_cdk/aws_rds/__init__.py +38 -27
- aws_cdk/aws_s3/__init__.py +215 -33
- aws_cdk/aws_s3objectlambda/__init__.py +2 -2
- aws_cdk/aws_sagemaker/__init__.py +872 -58
- aws_cdk/aws_secretsmanager/__init__.py +22 -8
- aws_cdk/aws_securityhub/__init__.py +261 -19
- aws_cdk/aws_securitylake/__init__.py +327 -7
- aws_cdk/aws_servicediscovery/__init__.py +5 -5
- aws_cdk/aws_sns/__init__.py +0 -8
- aws_cdk/aws_ssm/__init__.py +20 -12
- aws_cdk/aws_stepfunctions_tasks/__init__.py +36 -0
- aws_cdk/cx_api/__init__.py +19 -0
- {aws_cdk_lib-2.158.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/METADATA +1 -1
- {aws_cdk_lib-2.158.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/RECORD +62 -62
- {aws_cdk_lib-2.158.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/LICENSE +0 -0
- {aws_cdk_lib-2.158.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/NOTICE +0 -0
- {aws_cdk_lib-2.158.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/WHEEL +0 -0
- {aws_cdk_lib-2.158.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/top_level.txt +0 -0
aws_cdk/aws_s3/__init__.py
CHANGED
|
@@ -478,6 +478,110 @@ bucket = s3.Bucket(self, "MyBucket",
|
|
|
478
478
|
)
|
|
479
479
|
```
|
|
480
480
|
|
|
481
|
+
The above code will create a new bucket policy if none exists or update the
|
|
482
|
+
existing bucket policy to allow access log delivery.
|
|
483
|
+
|
|
484
|
+
However, there could be an edge case if the `accessLogsBucket` also defines a bucket
|
|
485
|
+
policy resource using the L1 Construct. Although the mixing of L1 and L2 Constructs is not
|
|
486
|
+
recommended, there are no mechanisms in place to prevent users from doing this at the moment.
|
|
487
|
+
|
|
488
|
+
```python
|
|
489
|
+
bucket_name = "my-favorite-bucket-name"
|
|
490
|
+
access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
|
|
491
|
+
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
|
|
492
|
+
bucket_name=bucket_name
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
# Creating a bucket policy using L1
|
|
496
|
+
bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
|
|
497
|
+
bucket=bucket_name,
|
|
498
|
+
policy_document={
|
|
499
|
+
"Statement": [{
|
|
500
|
+
"Action": "s3:*",
|
|
501
|
+
"Effect": "Deny",
|
|
502
|
+
"Principal": {
|
|
503
|
+
"AWS": "*"
|
|
504
|
+
},
|
|
505
|
+
"Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"Version": "2012-10-17"
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
# 'serverAccessLogsBucket' will create a new L2 bucket policy
|
|
514
|
+
# to allow log delivery and overwrite the L1 bucket policy.
|
|
515
|
+
bucket = s3.Bucket(self, "MyBucket",
|
|
516
|
+
server_access_logs_bucket=access_logs_bucket,
|
|
517
|
+
server_access_logs_prefix="logs"
|
|
518
|
+
)
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
The above example uses the L2 Bucket Construct with the L1 CfnBucketPolicy Construct. However,
|
|
522
|
+
when `serverAccessLogsBucket` is set, a new L2 Bucket Policy resource will be created
|
|
523
|
+
which overwrites the permissions defined in the L1 Bucket Policy causing unintended
|
|
524
|
+
behaviours.
|
|
525
|
+
|
|
526
|
+
As noted above, we highly discourage the mixed usage of L1 and L2 Constructs. The recommended
|
|
527
|
+
approach would to define the bucket policy using `addToResourcePolicy` method.
|
|
528
|
+
|
|
529
|
+
```python
|
|
530
|
+
access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
|
|
531
|
+
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
access_logs_bucket.add_to_resource_policy(
|
|
535
|
+
iam.PolicyStatement(
|
|
536
|
+
actions=["s3:*"],
|
|
537
|
+
resources=[access_logs_bucket.bucket_arn, access_logs_bucket.arn_for_objects("*")],
|
|
538
|
+
principals=[iam.AnyPrincipal()]
|
|
539
|
+
))
|
|
540
|
+
|
|
541
|
+
bucket = s3.Bucket(self, "MyBucket",
|
|
542
|
+
server_access_logs_bucket=access_logs_bucket,
|
|
543
|
+
server_access_logs_prefix="logs"
|
|
544
|
+
)
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Alternatively, users can use the L2 Bucket Policy Construct
|
|
548
|
+
`BucketPolicy.fromCfnBucketPolicy` to wrap around `CfnBucketPolicy` Construct. This will allow the subsequent bucket policy generated by `serverAccessLogsBucket` usage to append to the existing bucket policy instead of overwriting.
|
|
549
|
+
|
|
550
|
+
```python
|
|
551
|
+
bucket_name = "my-favorite-bucket-name"
|
|
552
|
+
access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
|
|
553
|
+
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
|
|
554
|
+
bucket_name=bucket_name
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
|
|
558
|
+
bucket=bucket_name,
|
|
559
|
+
policy_document={
|
|
560
|
+
"Statement": [{
|
|
561
|
+
"Action": "s3:*",
|
|
562
|
+
"Effect": "Deny",
|
|
563
|
+
"Principal": {
|
|
564
|
+
"AWS": "*"
|
|
565
|
+
},
|
|
566
|
+
"Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
],
|
|
570
|
+
"Version": "2012-10-17"
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
|
|
574
|
+
# Wrap L1 Construct with L2 Bucket Policy Construct. Subsequent
|
|
575
|
+
# generated bucket policy to allow access log delivery would append
|
|
576
|
+
# to the current policy.
|
|
577
|
+
s3.BucketPolicy.from_cfn_bucket_policy(bucket_policy)
|
|
578
|
+
|
|
579
|
+
bucket = s3.Bucket(self, "MyBucket",
|
|
580
|
+
server_access_logs_bucket=access_logs_bucket,
|
|
581
|
+
server_access_logs_prefix="logs"
|
|
582
|
+
)
|
|
583
|
+
```
|
|
584
|
+
|
|
481
585
|
## S3 Inventory
|
|
482
586
|
|
|
483
587
|
An [inventory](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) contains a list of the objects in the source bucket and metadata for each object. The inventory lists are stored in the destination bucket as a CSV file compressed with GZIP, as an Apache optimized row columnar (ORC) file compressed with ZLIB, or as an Apache Parquet (Parquet) file compressed with Snappy.
|
|
@@ -1575,24 +1679,55 @@ class BucketPolicy(
|
|
|
1575
1679
|
policy if one doesn't exist yet, otherwise it will add to the existing
|
|
1576
1680
|
policy.
|
|
1577
1681
|
|
|
1578
|
-
|
|
1682
|
+
The bucket policy method is implemented differently than ``addToResourcePolicy()``
|
|
1683
|
+
as ``BucketPolicy()`` creates a new policy without knowing one earlier existed.
|
|
1684
|
+
e.g. if during Bucket creation, if ``autoDeleteObject:true``, these policies are
|
|
1685
|
+
added to the bucket policy:
|
|
1686
|
+
["s3:DeleteObject*", "s3:GetBucket*", "s3:List*", "s3:PutBucketPolicy"],
|
|
1687
|
+
and when you add a new BucketPolicy with ["s3:GetObject", "s3:ListBucket"] on
|
|
1688
|
+
this existing bucket, invoking ``BucketPolicy()`` will create a new Policy
|
|
1689
|
+
without knowing one earlier exists already, so it creates a new one.
|
|
1690
|
+
In this case, the custom resource handler will not have access to
|
|
1691
|
+
``s3:GetBucketTagging`` action which will cause failure during deletion of stack.
|
|
1579
1692
|
|
|
1580
|
-
|
|
1693
|
+
Hence its strongly recommended to use ``addToResourcePolicy()`` method to add
|
|
1694
|
+
new permissions to existing policy.
|
|
1695
|
+
|
|
1696
|
+
:exampleMetadata: infused
|
|
1581
1697
|
|
|
1582
1698
|
Example::
|
|
1583
1699
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1700
|
+
bucket_name = "my-favorite-bucket-name"
|
|
1701
|
+
access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
|
|
1702
|
+
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
|
|
1703
|
+
bucket_name=bucket_name
|
|
1704
|
+
)
|
|
1588
1705
|
|
|
1589
|
-
|
|
1706
|
+
bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
|
|
1707
|
+
bucket=bucket_name,
|
|
1708
|
+
policy_document={
|
|
1709
|
+
"Statement": [{
|
|
1710
|
+
"Action": "s3:*",
|
|
1711
|
+
"Effect": "Deny",
|
|
1712
|
+
"Principal": {
|
|
1713
|
+
"AWS": "*"
|
|
1714
|
+
},
|
|
1715
|
+
"Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
|
|
1716
|
+
]
|
|
1717
|
+
}
|
|
1718
|
+
],
|
|
1719
|
+
"Version": "2012-10-17"
|
|
1720
|
+
}
|
|
1721
|
+
)
|
|
1590
1722
|
|
|
1591
|
-
|
|
1592
|
-
|
|
1723
|
+
# Wrap L1 Construct with L2 Bucket Policy Construct. Subsequent
|
|
1724
|
+
# generated bucket policy to allow access log delivery would append
|
|
1725
|
+
# to the current policy.
|
|
1726
|
+
s3.BucketPolicy.from_cfn_bucket_policy(bucket_policy)
|
|
1593
1727
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1728
|
+
bucket = s3.Bucket(self, "MyBucket",
|
|
1729
|
+
server_access_logs_bucket=access_logs_bucket,
|
|
1730
|
+
server_access_logs_prefix="logs"
|
|
1596
1731
|
)
|
|
1597
1732
|
'''
|
|
1598
1733
|
|
|
@@ -3661,7 +3796,7 @@ class CfnAccessPoint(
|
|
|
3661
3796
|
:param block_public_acls: 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.
|
|
3662
3797
|
:param block_public_policy: 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.
|
|
3663
3798
|
:param ignore_public_acls: 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.
|
|
3664
|
-
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS
|
|
3799
|
+
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS 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.
|
|
3665
3800
|
|
|
3666
3801
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-accesspoint-publicaccessblockconfiguration.html
|
|
3667
3802
|
:exampleMetadata: fixture=_generated
|
|
@@ -3750,7 +3885,7 @@ class CfnAccessPoint(
|
|
|
3750
3885
|
) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
|
|
3751
3886
|
'''Specifies whether Amazon S3 should restrict public bucket policies for this bucket.
|
|
3752
3887
|
|
|
3753
|
-
Setting this element to ``TRUE`` restricts access to this bucket to only AWS
|
|
3888
|
+
Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy.
|
|
3754
3889
|
|
|
3755
3890
|
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.
|
|
3756
3891
|
|
|
@@ -7265,7 +7400,7 @@ class CfnBucket(
|
|
|
7265
7400
|
:param block_public_acls: 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.
|
|
7266
7401
|
:param block_public_policy: 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.
|
|
7267
7402
|
:param ignore_public_acls: 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.
|
|
7268
|
-
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS
|
|
7403
|
+
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS 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.
|
|
7269
7404
|
|
|
7270
7405
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-publicaccessblockconfiguration.html
|
|
7271
7406
|
:exampleMetadata: fixture=_generated
|
|
@@ -7354,7 +7489,7 @@ class CfnBucket(
|
|
|
7354
7489
|
) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
|
|
7355
7490
|
'''Specifies whether Amazon S3 should restrict public bucket policies for this bucket.
|
|
7356
7491
|
|
|
7357
|
-
Setting this element to ``TRUE`` restricts access to this bucket to only AWS
|
|
7492
|
+
Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy.
|
|
7358
7493
|
|
|
7359
7494
|
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.
|
|
7360
7495
|
|
|
@@ -10300,19 +10435,39 @@ class CfnBucketPolicy(
|
|
|
10300
10435
|
|
|
10301
10436
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucketpolicy.html
|
|
10302
10437
|
:cloudformationResource: AWS::S3::BucketPolicy
|
|
10303
|
-
:exampleMetadata:
|
|
10438
|
+
:exampleMetadata: infused
|
|
10304
10439
|
|
|
10305
10440
|
Example::
|
|
10306
10441
|
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10442
|
+
bucket_name = "my-favorite-bucket-name"
|
|
10443
|
+
access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
|
|
10444
|
+
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
|
|
10445
|
+
bucket_name=bucket_name
|
|
10446
|
+
)
|
|
10310
10447
|
|
|
10311
|
-
#
|
|
10448
|
+
# Creating a bucket policy using L1
|
|
10449
|
+
bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
|
|
10450
|
+
bucket=bucket_name,
|
|
10451
|
+
policy_document={
|
|
10452
|
+
"Statement": [{
|
|
10453
|
+
"Action": "s3:*",
|
|
10454
|
+
"Effect": "Deny",
|
|
10455
|
+
"Principal": {
|
|
10456
|
+
"AWS": "*"
|
|
10457
|
+
},
|
|
10458
|
+
"Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
|
|
10459
|
+
]
|
|
10460
|
+
}
|
|
10461
|
+
],
|
|
10462
|
+
"Version": "2012-10-17"
|
|
10463
|
+
}
|
|
10464
|
+
)
|
|
10312
10465
|
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10466
|
+
# 'serverAccessLogsBucket' will create a new L2 bucket policy
|
|
10467
|
+
# to allow log delivery and overwrite the L1 bucket policy.
|
|
10468
|
+
bucket = s3.Bucket(self, "MyBucket",
|
|
10469
|
+
server_access_logs_bucket=access_logs_bucket,
|
|
10470
|
+
server_access_logs_prefix="logs"
|
|
10316
10471
|
)
|
|
10317
10472
|
'''
|
|
10318
10473
|
|
|
@@ -10413,19 +10568,39 @@ class CfnBucketPolicyProps:
|
|
|
10413
10568
|
:param policy_document: A policy document containing permissions to add to the specified bucket. In IAM, you must provide policy documents in JSON format. However, in CloudFormation you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to IAM. For more information, see the AWS::IAM::Policy `PolicyDocument <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-policydocument>`_ resource description in this guide and `Access Policy Language Overview <https://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html>`_ in the *Amazon S3 User Guide* .
|
|
10414
10569
|
|
|
10415
10570
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucketpolicy.html
|
|
10416
|
-
:exampleMetadata:
|
|
10571
|
+
:exampleMetadata: infused
|
|
10417
10572
|
|
|
10418
10573
|
Example::
|
|
10419
10574
|
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10575
|
+
bucket_name = "my-favorite-bucket-name"
|
|
10576
|
+
access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
|
|
10577
|
+
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
|
|
10578
|
+
bucket_name=bucket_name
|
|
10579
|
+
)
|
|
10423
10580
|
|
|
10424
|
-
#
|
|
10581
|
+
# Creating a bucket policy using L1
|
|
10582
|
+
bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
|
|
10583
|
+
bucket=bucket_name,
|
|
10584
|
+
policy_document={
|
|
10585
|
+
"Statement": [{
|
|
10586
|
+
"Action": "s3:*",
|
|
10587
|
+
"Effect": "Deny",
|
|
10588
|
+
"Principal": {
|
|
10589
|
+
"AWS": "*"
|
|
10590
|
+
},
|
|
10591
|
+
"Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
|
|
10592
|
+
]
|
|
10593
|
+
}
|
|
10594
|
+
],
|
|
10595
|
+
"Version": "2012-10-17"
|
|
10596
|
+
}
|
|
10597
|
+
)
|
|
10425
10598
|
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10599
|
+
# 'serverAccessLogsBucket' will create a new L2 bucket policy
|
|
10600
|
+
# to allow log delivery and overwrite the L1 bucket policy.
|
|
10601
|
+
bucket = s3.Bucket(self, "MyBucket",
|
|
10602
|
+
server_access_logs_bucket=access_logs_bucket,
|
|
10603
|
+
server_access_logs_prefix="logs"
|
|
10429
10604
|
)
|
|
10430
10605
|
'''
|
|
10431
10606
|
if __debug__:
|
|
@@ -11096,7 +11271,7 @@ class CfnMultiRegionAccessPoint(
|
|
|
11096
11271
|
:param block_public_acls: 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.
|
|
11097
11272
|
:param block_public_policy: 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.
|
|
11098
11273
|
:param ignore_public_acls: 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.
|
|
11099
|
-
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS
|
|
11274
|
+
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS 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.
|
|
11100
11275
|
|
|
11101
11276
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-multiregionaccesspoint-publicaccessblockconfiguration.html
|
|
11102
11277
|
:exampleMetadata: fixture=_generated
|
|
@@ -11185,7 +11360,7 @@ class CfnMultiRegionAccessPoint(
|
|
|
11185
11360
|
) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
|
|
11186
11361
|
'''Specifies whether Amazon S3 should restrict public bucket policies for this bucket.
|
|
11187
11362
|
|
|
11188
|
-
Setting this element to ``TRUE`` restricts access to this bucket to only AWS
|
|
11363
|
+
Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy.
|
|
11189
11364
|
|
|
11190
11365
|
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.
|
|
11191
11366
|
|
|
@@ -17462,6 +17637,13 @@ class ObjectOwnership(enum.Enum):
|
|
|
17462
17637
|
object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
|
|
17463
17638
|
)
|
|
17464
17639
|
|
|
17640
|
+
access_logs_bucket.add_to_resource_policy(
|
|
17641
|
+
iam.PolicyStatement(
|
|
17642
|
+
actions=["s3:*"],
|
|
17643
|
+
resources=[access_logs_bucket.bucket_arn, access_logs_bucket.arn_for_objects("*")],
|
|
17644
|
+
principals=[iam.AnyPrincipal()]
|
|
17645
|
+
))
|
|
17646
|
+
|
|
17465
17647
|
bucket = s3.Bucket(self, "MyBucket",
|
|
17466
17648
|
server_access_logs_bucket=access_logs_bucket,
|
|
17467
17649
|
server_access_logs_prefix="logs"
|
|
@@ -733,7 +733,7 @@ class CfnAccessPoint(
|
|
|
733
733
|
:param block_public_acls: Specifies whether Amazon S3 should block public access control lists (ACLs) for buckets in this account. Setting this element to ``TRUE`` causes the following behavior: - ``PutBucketAcl`` and ``PutObjectAcl`` 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. This property is not supported for Amazon S3 on Outposts.
|
|
734
734
|
:param block_public_policy: Specifies whether Amazon S3 should block public bucket policies for buckets in this account. 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. This property is not supported for Amazon S3 on Outposts.
|
|
735
735
|
:param ignore_public_acls: Specifies whether Amazon S3 should ignore public ACLs for buckets in this account. Setting this element to ``TRUE`` causes Amazon S3 to ignore all public ACLs on buckets in this account and any objects that they contain. Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. This property is not supported for Amazon S3 on Outposts.
|
|
736
|
-
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for buckets in this account. Setting this element to ``TRUE`` restricts access to buckets with public policies to only AWS
|
|
736
|
+
:param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for buckets in this account. Setting this element to ``TRUE`` restricts access to buckets with public policies to only AWS service principals and authorized users within this account. 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. This property is not supported for Amazon S3 on Outposts.
|
|
737
737
|
|
|
738
738
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3objectlambda-accesspoint-publicaccessblockconfiguration.html
|
|
739
739
|
:exampleMetadata: fixture=_generated
|
|
@@ -828,7 +828,7 @@ class CfnAccessPoint(
|
|
|
828
828
|
) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
|
|
829
829
|
'''Specifies whether Amazon S3 should restrict public bucket policies for buckets in this account.
|
|
830
830
|
|
|
831
|
-
Setting this element to ``TRUE`` restricts access to buckets with public policies to only AWS
|
|
831
|
+
Setting this element to ``TRUE`` restricts access to buckets with public policies to only AWS service principals and authorized users within this account.
|
|
832
832
|
|
|
833
833
|
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.
|
|
834
834
|
|