[![NPM version](https://badge.fury.io/js/cdk-s3bucket-ng.svg)](https://badge.fury.io/js/cdk-s3bucket-ng)
[![PyPI version](https://badge.fury.io/py/cdk-s3bucket-ng.svg)](https://badge.fury.io/py/cdk-s3bucket-ng)
![Release](https://github.com/guan840912/cdk-s3bucket/workflows/Release/badge.svg)
![Downloads](https://img.shields.io/badge/-DOWNLOADS:-brightgreen?color=gray)
![npm](https://img.shields.io/npm/dt/cdk-s3bucket-ng?label=npm&color=orange)
![PyPI](https://img.shields.io/pypi/dm/cdk-s3bucket-ng?label=pypi&color=blue)
# cdk-s3bucket-ng
cdk-s3bucket-ng is an AWS CDK construct library that provides a drop-in replacement for the Bucket construct with the capability to remove non-empty S3 buckets.
# Why
Sometime we just do some lab , create a S3 Bucket.
Want to destroy resource , after Lab finished.
But We forget delete Object in S3 Bucket first , so destroy will fail.
`cdk-s3bucket-ng` can help delete object when cdk destroy , just add `removalPolicy: RemovalPolicy.DESTROY` property .
You never have to delete objects yourself, and the usage is almost the same as the native @aws-cdk/aws-s3.Bucket
## Now Try It !!!
# Sample
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.core import App, Stack, CfnOutput, RemovalPolicy
from cdk_s3bucket_ng import BucketNg
import aws_cdk.aws_s3_deployment as s3deploy
# Create a S3 , add props "removalPolicy: RemovalPolicy.DESTROY".
bucket = BucketNg(stack, "Bucket",
removal_policy=RemovalPolicy.DESTROY
)
# Upload temp file .
s3deploy.BucketDeployment(stack, "addResource",
sources=[s3deploy.Source.asset("./testdir")],
destination_bucket=bucket
)
# Get S3 Resource via bucket.s3Bucket ...
CfnOutput(stack, "BucketName", value=bucket.bucket_name)
```
```bash
# create temp file .
mkdir ./testdir
touch ./testdir/{a.txt,b.txt,c.txt}
ls ./testdir
a.txt b.txt c.txt
```
### To deploy
```bash
cdk deploy
```
### To destroy
```bash
# will delete object in S3 , and delete S3 Bucket
cdk destroy
```
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
最新资源
- 毕设和企业适用springboot智能制造平台类及数字货币管理平台源码+论文+视频.zip
- 毕设和企业适用springboot智能制造平台类及在线教育管理系统源码+论文+视频.zip
- 毕设和企业适用springboot智能制造平台类及在线药品管理平台源码+论文+视频.zip
- 毕设和企业适用springboot智能制造平台类及在线音乐平台源码+论文+视频.zip
- 毕设和企业适用springboot智能制造平台类及资产管理平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及电影票务系统源码+论文+视频.zip
- 毕设和企业适用springboot智能制造平台类及自动化控制系统源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及客户服务智能化平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及客户管理系统源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及企业管理智能化平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及数据可视化平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及团队协作平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及网络安全防护平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及物流追踪系统源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及医疗信息管理平台源码+论文+视频.zip
- 毕设和企业适用springboot众筹平台类及线上文件管理系统源码+论文+视频.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈