Skip to content

Instantly share code, notes, and snippets.

@allanchua101
Created August 24, 2020 09:28
Show Gist options
  • Save allanchua101/ce8303adae345c3edc3e0fc100e9c1c8 to your computer and use it in GitHub Desktop.
Save allanchua101/ce8303adae345c3edc3e0fc100e9c1c8 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: "2010-09-09"
Description: >
CloudFormation template used for provisioning SAM artifact storage for environments
that require rapid expiration of build artifacts.
Parameters:
AppName:
Type: String
Description: "Name of application."
AllowedPattern: ".+"
Default: "ninja-buckets"
Environment:
Type: String
Description: "Environment code of deployment (dev, uat, prod)"
AllowedPattern: ".+"
AllowedValues:
- "dev"
- "uat"
- "prod"
Resources:
SamArtifactStorage:
Type: AWS::S3::Bucket
Properties:
BucketName: !Join ["-", [!Ref AppName, !Ref Environment, "sam-artifacts"]]
LifecycleConfiguration:
Rules:
- Id: DeleteDevArtifactsAfterOneDay
Status: "Enabled"
ExpirationInDays: 1
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
Tags:
- Key: "ENVIRONMENT"
Value: !Ref Environment
- Key: "APP"
Value: !Ref AppName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment