Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
docs: ✏️ add a section about cleaning the bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
Amri91 committed Jan 30, 2019
1 parent 5d07703 commit ad5a7d4
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion doc_source/serverless-deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,33 @@ You can use AWS SAM with a number of other AWS services to automate the deployme
+ **AWS CodePipeline**: You use AWS CodePipeline to model, visualize, and automate the steps that are required to release your serverless application\. For more information, see [What Is AWS CodePipeline?](https://docs.aws.amazon.com/codepipeline/latest/APIReference/)\.

**Topics**
+ [Gradual Code Deployment](automating-updates-to-serverless-apps.md)
+ [Gradual Code Deployment](automating-updates-to-serverless-apps.md)

## Cleaning up the bucket

After the Lambda is created, a "private" copy of the code is made.
In the case you're using S3 for the code, you can safely remove your objects after creating the functions. One way to do that is using a Lifecycle rule.

Using CloudFormation
```yml
Outputs:
BucketName:
Value: !Ref CodeBucket
Description: The name of your code bucket.

Resources:
CodeBucket:
Type: AWS::S3::Bucket
Properties:
LifecycleConfiguration:
Rules:
- ExpirationInDays: 1
Status: Enabled
```
Using the CLI
```bash
aws s3 mb s3://{bucketNname}
aws s3api put-bucket-lifecycle-configuration --bucket {bucketNname} --lifecycle-configuration '{"Rules": [{"Expiration": {"Days": 1}, "ID": "Expire old objects", "Prefix": "", "Status": "Enabled"}]}
'
```

0 comments on commit ad5a7d4

Please sign in to comment.