Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
Create Multiple S3 Buckets having same properties with cloudformation

I'm trying to create multiple S3 bucktes with same propeties.But I'm not able to create multiple s3 buckets.

I found in http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html if you have multiple resources of the same type, you can declare them together by separating them with commas

But I didn't find any example and I'm not sure how to do it.I tried debugging but not getting the result. Please suggest. Below is my yaml file:

AWSTemplateFormatVersion: '2010-09-09'
Resources:
  myS3Bucketlo:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: AuthenticatedRead
Outputs:
  WebsiteURL:
    Value: !GetAtt myS3Bucketlo.WebsiteURL
    Description: URL for the website hosted on S3
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In a CloudFormation template, each resource must be declared separately. So, even if your buckets have identical properties, they still must be individually declared:

AWSTemplateFormatVersion: '2010-09-09'
Resources:
  bucket1:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: AuthenticatedRead
  bucket2:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: AuthenticatedRead
  bucket3:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: AuthenticatedRead
Outputs:
  WebsiteURL1:
    Value: !GetAtt bucket1.WebsiteURL
    Description: URL for the website 1 hosted on S3
  WebsiteURL2:
    Value: !GetAtt bucket2.WebsiteURL
    Description: URL for the website 2 hosted on S3
  WebsiteURL3:
    Value: !GetAtt bucket3.WebsiteURL
    Description: URL for the website 3 hosted on S3

However,

You must declare each resource separately; however, if you have multiple resources of the same type, you can declare them together by separating them with commas.

The wording of this text does imply there is a shortcut to avoid duplication, but I have never seen such a working example.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!