learn-aws-by-coding icon indicating copy to clipboard operation
learn-aws-by-coding copied to clipboard

13.3. アプリケーションのデプロイの実行エラーについて

Open kakukeko opened this issue 1 year ago • 0 comments

13.3. アプリケーションのデプロイにて cdk deploy を実行すると下記のエラーが発生しました。

Stack Deployments Failed: Error: The stack named Bashoutter failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: API: s3:PutBucketPolicy Access Denied

2023 年 4 月からS3 パブリックアクセスブロック設定はすべて有効になったようなので、 Amazon S3 ストレージへのパブリックアクセスのブロック

app.pyの下記部分を

        # <2>
        bucket = s3.Bucket(
            self, "Bashoutter-Bucket",
            website_index_document="index.html",
            public_read_access=True,
            auto_delete_objects=True,
            removal_policy=core.RemovalPolicy.DESTROY
        )

下記へ変更し実行すると、エラーなくハンズオンを進めることができました。

        # <2>
        bucket = s3.Bucket(
            self, "Bashoutter-Bucket",
            website_index_document="index.html",
            public_read_access=True,
            auto_delete_objects=True,
            removal_policy=core.RemovalPolicy.DESTROY,
            block_public_access=s3.BlockPublicAccess(
                block_public_policy=False
                )
        )

これで良いのか不明です。

kakukeko avatar May 18 '23 08:05 kakukeko