Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Let Cloudformation generate names for S3 resources #123

Closed
ashb opened this issue Jun 26, 2015 · 2 comments · Fixed by #132
Closed

Let Cloudformation generate names for S3 resources #123

ashb opened this issue Jun 26, 2015 · 2 comments · Fixed by #132

Comments

@ashb
Copy link
Contributor

ashb commented Jun 26, 2015

We currently hard code the name of the ELB, RDS and S3 buckets that bootstrap-cfn creates.

This means that creating duplicate environments of the same flavour (i.e. another 'dev' env) means we have to duplicate the block in the YAML and change some identifiers.

Instead we can do this:

{
    "Outputs": {
      "staticbucket": {
        "Description": "x",
        "Value": { "Ref": "StaticBucket" }
      }
    },
    "Resources": {
        "StaticBucket": {
            "Properties": {
                "AccessControl": "BucketOwnerFullControl"
            },
            "Type": "AWS::S3::Bucket"
        }
    }
}

Note how there's no BucketName specified.

I went and created this template and cloudformation with a stack name of "Ash-s3-test" and the bucket that was created was ash-s3-test-staticbucket-1hgn7cc7bhnak – that's <stackname>-<logical-resource-name>-<random>. Given that we can make it an output this means we can find the name given in the same way we do with RDS.

We should do similar things for the ELB (where the name of ELB doesn't matter, just the DNS name) and RDS (which we don't need the name at all anyway - just the endpoint which is already an output)

@ashb ashb added the ready label Jun 26, 2015
@sevenmachines sevenmachines self-assigned this Jul 20, 2015
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- Ignore S3 bucket names in config and use dynamic ones instead
- Add a method to fetch all the buckets for this stack
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- Ignore S3 bucket names in config and use dynamic ones instead
- Add a method to fetch all the buckets for this stack
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method to fetch all the buckets for this stack
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method to fetch all the buckets for this stack
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method to fetch all the buckets for this stack
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method to fetch all the buckets for this stack
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method to fetch all the buckets for this stack
- Update tests to look for new BucketName output and policy changes
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method and fab_file function to allow getting a filtered
list of resources
- Update tests to look for new BucketName output and policy changes
- PEP8 fixes
@sevenmachines
Copy link
Contributor

#132
Creates the bootstrap functions and changes needed to allow random naming of buckets

https://github.com/ministryofjustice/template-deploy/pull/114
Changes template deploy to use the new system

sevenmachines pushed a commit that referenced this issue Jul 20, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method and fab_file function to allow getting a filtered
list of resources
- Update tests to look for new BucketName output and policy changes
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 21, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method and fab_file function to allow getting a filtered
list of resources
- Update tests to look for new BucketName output and policy changes
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 21, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method and fab_file function to allow getting a filtered
list of resources
- Update tests to look for new BucketName output and policy changes
- PEP8 fixes
sevenmachines pushed a commit that referenced this issue Jul 21, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method and fab_file function to allow getting a filtered
list of resources
- Update tests to look for new BucketName output and policy changes
- Add test to check config with s3 key but no subkeys loads ok
- PEP8 fixes
@sevenmachines sevenmachines removed their assignment Jul 21, 2015
@sevenmachines
Copy link
Contributor

If we can seperate out doing something similar for RDS and ELB's into other issues, to keep the PR size reviewable

@sevenmachines sevenmachines changed the title Let Cloudformation generate names for S3, ELB, and RDS resources Let Cloudformation generate names for S3 resources Jul 21, 2015
sevenmachines pushed a commit that referenced this issue Jul 22, 2015
Currently we use hard coded names for resources like S3. This change
will allow us to use dynamic names auto-generated by aws and exposed
as an output. (Closes #123)

- S3 bucket names are optional in config, default to dynamic ones
- Add a method and fab_file function to allow getting a filtered
list of resources
- Update tests to look for new BucketName output and policy changes
- Add test to check config with s3 key but no subkeys loads ok
- PEP8 fixes
@sevenmachines sevenmachines self-assigned this Jul 23, 2015
@sevenmachines sevenmachines removed their assignment Jul 23, 2015
@ashb ashb closed this as completed in #132 Jul 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants