aws:aws-cloudformation-s3
Differences
This shows you the differences between two versions of the page.
| aws:aws-cloudformation-s3 [06/08/2024 09:28] – created - external edit 127.0.0.1 | aws:aws-cloudformation-s3 [30/05/2025 09:40] (current) – removed andrew | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== S3 buckets ====== | ||
| - | |||
| - | S3 is an Object store not a filesystem although at first glance, it can seem like one. | ||
| - | |||
| - | Although S3 buckets are tied to a region, the name for a bucket must be globally unique. This can pose a problem in deploying code developed in Dev to Prod as if bucket names are hard coded, there will be a conflict beween Prod and Dev on deployment. Editing code between deployments to change a bucket name is not a great idea, but introducing a limited amount of randomness to the name can avoid this. | ||
| - | |||
| - | Using a Env Variable or Parameter !Join-ed to a bucket name can help, but it still requires some setup outside of the deployed code. | ||
| - | |||
| - | Developing an idea I have used in BASH for adding a process id ($$) to a temp file to avoid clashes if a script is launched multiple times so there are several copies running at the same time. | ||
| - | |||
| - | #!/bin/bash | ||
| - | REPORT_FILE="/ | ||
| - | | ||
| - | |||
| - | If we are running a Cloudformation stack, the stack id is guaranteed to be unique in our account and probably is globally too, \\ | ||
| - | (arn: | ||
| - | |||
| - | We can '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | <code YAML> | ||
| - | !Select | ||
| - | - 4 | ||
| - | - !Split | ||
| - | - "/" | ||
| - | - !Ref " | ||
| - | |||
| - | </ | ||
| - | |||
| - | Gives '' | ||
| - | |||
| - | <code yaml> | ||
| - | - !Select | ||
| - | - 4 | ||
| - | - !Split | ||
| - | - " | ||
| - | - !Select | ||
| - | - 2 | ||
| - | - !Split | ||
| - | - "/" | ||
| - | - !Ref " | ||
| - | </ | ||
| - | |||
| - | Then we can '' | ||
| - | |||
| - | <code yaml> | ||
| - | --- | ||
| - | AWSTemplateFormatVersion: | ||
| - | Description: | ||
| - | |||
| - | Resources: | ||
| - | ReportsBucket: | ||
| - | Type: AWS:: | ||
| - | Properties: | ||
| - | Name: UniqueNameBucket | ||
| - | Type: String | ||
| - | Value: !Ref UniqueNameBucket | ||
| - | |||
| - | |||
| - | UniqueNameBucket: | ||
| - | Type: " | ||
| - | Properties: | ||
| - | BucketName: !Join | ||
| - | - " | ||
| - | - " | ||
| - | - !Select | ||
| - | - 4 | ||
| - | - !Split | ||
| - | - " | ||
| - | - !Select | ||
| - | - 2 | ||
| - | - !Split | ||
| - | - "/" | ||
| - | - !Ref " | ||
| - | |||
| - | Outputs: | ||
| - | UniqueNameBucket: | ||
| - | Description: | ||
| - | Value: !Ref UniqueNameBucket | ||
| - | </ | ||
| - | |||
| - | |||
| - | This page has been accessed for:- \\ | ||
| - | Today: {{counter|today}} \\ | ||
| - | Yesterday: {{counter|yesterday}} \\ | ||
| - | Until now: {{counter|total}} \\ | ||
aws/aws-cloudformation-s3.1722936498.txt.gz · Last modified: by 127.0.0.1
