https://github.com/sbstjn/archive
Amazon S3 Replication with KMS, CDK, and CloudFormation StackSets.
https://github.com/sbstjn/archive
aws cdk s3
Last synced: 10 months ago
JSON representation
Amazon S3 Replication with KMS, CDK, and CloudFormation StackSets.
- Host: GitHub
- URL: https://github.com/sbstjn/archive
- Owner: sbstjn
- License: mit
- Created: 2020-12-30T22:32:27.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-01T17:55:40.000Z (over 3 years ago)
- Last Synced: 2025-04-21T22:36:47.418Z (about 1 year ago)
- Topics: aws, cdk, s3
- Language: TypeScript
- Homepage: https://sbstjn.com/blog/aws-cdk-s3-bucket-reginal-replication-kms/
- Size: 187 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# S3 Archive with Regional Replications
[](https://github.com/sbstjn/archive/blob/master/LICENSE.md)
[](https://sbstjn.com/blog/aws-cdk-s3-bucket-reginal-replication-kms/)
> Use the AWS Cloud Development Kit to deploy an Amazon S3 Bucket in your desired region and enable regional bucket replications for backups.
## Architecture
* CloudFormation Stack with S3 Bucket, KMS, and StackSet
* CloudFormation StackSet for S3 regional replication
## Usage
### Prerequisites
To use self-managed StackSets, you need to [create two IAM roles](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html) first. You can create them manually using the AWS Management Console or use the official CloudFormation templates provided by AWS:
- [AWSCloudFormationStackSetAdministrationRole.yml](https://s3.amazonaws.com/cloudformation-stackset-sample-templates-us-east-1/AWSCloudFormationStackSetAdministrationRole.yml)
- [AWSCloudFormationStackSetExecutionRole.yml](https://s3.amazonaws.com/cloudformation-stackset-sample-templates-us-east-1/AWSCloudFormationStackSetExecutionRole.yml)
### Configuration
Modify `aws/index.ts` to configure your archive and replication:
```js
const prefix = 'example'
const option = {
prefix,
env: {
region: 'eu-central-1'
},
replications: [
'eu-west-1',
'eu-north-1'
]
}
```
### Deployment
```bash
# Deploy CloudFormation Stack with CDK
$ > npx cdk deploy
[…]
Outputs:
Archive.BucketName = example-archive
Archive.BucketRegion = eu-central-1
Archive.BucketReplications = eu-west-1, eu-north-1
```