• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

How to create multiple S3 buckets using Cloudformation template

TECH

  • 4 min read
How to create multiple S3 buckets using Cloudformation template

Generating audio, please wait...

AWS CloudFormation provides you with a simple way to create and manage a collection of AWS resources by provisioning and updating them in an orderly and predictable way. In simple terms, it allows you to create and model your infrastructure and applications without having to perform actions manually.

AWS CloudFormation enables you to manage your complete infrastructure or AWS resources in a text file, or template. A collection of AWS resources is called a stack. AWS resources can be created or updated by using a stack.

The following guide will go through the steps involved in setting up a cloudformation template to create multiple S3 buckets.

Create a new template or use an existing CloudFormation template using the JSON or YAML format.

Here, I’m using a new template in YAML format, copy and paste the following code to make the YAML template.

AWSTemplateFormatVersion: 2010-09-09
 
Description: AWS CloudFormation template - to create S3 buckets.
 
Parameters:
  BucketNameParameter1:
    Type: String
    Description: Bucket Name
  BucketNameParameter2:
    Type: String
    Description: Bucket Name
  BucketNameParameter3:
    Type: String
    Description: Bucket Name
 
  EnvironmentType:
    Description: 'Specify the Environment type of the stack.'
    Type: String
    Default: SupportSages-Test
    AllowedValues:
      - SupportSages-Test
      - SupportSages-Prod
      - SupportSages-Dev
    ConstraintDescription: 'Specify either SupportSages-Test or SupportSages-Prod.'
 
Resources:
  S3Bucket1:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: PublicRead
      BucketName: !Ref BucketNameParameter1
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: AES256
      VersioningConfiguration:
        Status: Enabled
  S3Bucket2:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: PublicRead
      BucketName: !Ref BucketNameParameter2
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: AES256
      VersioningConfiguration:
        Status: Enabled
   
  S3Bucket3:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: PublicRead
      BucketName: !Ref BucketNameParameter3
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: AES256
      VersioningConfiguration:
        Status: Enabled
 
  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      PolicyDocument:
        Id: MyPolicy
        Version: 2012-10-17
        Statement:
          - Sid: PublicReadForGetBucketObjects
            Effect: Allow
            Principal: '*'
            Action: 's3:GetObject'
            Resource: !Join
              - ''
              - - 'arn:aws:s3:::'
                - !Ref S3Bucket1
                - /*
      Bucket: !Ref S3Bucket1
  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      PolicyDocument:
        Id: MyPolicy
        Version: 2012-10-17
        Statement:
          - Sid: PublicReadForGetBucketObjects
            Effect: Allow
            Principal: '*'
            Action: 's3:GetObject'
            Resource: !Join
              - ''
              - - 'arn:aws:s3:::'
                - !Ref S3Bucket2
                - /*
      Bucket: !Ref S3Bucket2
 
  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      PolicyDocument:
        Id: MyPolicy
        Version: 2012-10-17
        Statement:
          - Sid: PublicReadForGetBucketObjects
            Effect: Allow
            Principal: '*'
            Action: 's3:GetObject'
            Resource: !Join
              - ''
              - - 'arn:aws:s3:::'
                - !Ref S3Bucket3
                - /*
      Bucket: !Ref S3Bucket3
 
Outputs:
  BucketName1:
    Value: !Ref S3Bucket1
  WebsiteURL1:
    Value: !GetAtt [S3Bucket1, WebsiteURL]
    Description: URL for website hosted on S3
  BucketName2:
    Value: !Ref S3Bucket2
  WebsiteURL2:
    Value: !GetAtt [S3Bucket2, WebsiteURL]
    Description: URL for website hosted on S3
  BucketName3:
    Value: !Ref S3Bucket3
  WebsiteURL3:
    Value: !GetAtt [S3Bucket3, WebsiteURL]
    Description: URL for website hosted on S3

Choose Cloudformation from AWS and click on Create stack and follow:

  • Open the AWS CloudFormation link in a new tab and log in to your AWS account.
  • Click on Create stack (With new resources (Standard) if you have clicked in the top right corner).
  • In Prepare template, choose Template is ready.
  • In Template source, choose Upload a template file.
  • Click on Choose file button and select the file template, Here, I’m using my template with the filename

`S3_bucket_template.yaml` and click Next.

  • Provide a Stack name. For example `MultipleS3`.
  • The Stack name identifies the stack. Use a name to help you distinguish the purpose of this stack.
  • Give in the names of the S3 buckets and click Next.
  • You can leave Configure stack options default, click Next.
  • On the Review page, scroll down to the bottom and click on Create stack.
  • You can click the refresh button a few times until you see in the status CREATE_COMPLETE

  • You can leave Configure stack options default, click Next.
  • On the Review page, scroll down to the bottom and click on Create stack.
  • You can click the refresh button a few times until you see in the status CREATE_COMPLETE.
  • AWS

Looking for AWS Experts?

We provide top-of-the-line custom AWS setup services tailored to your needs.

How to create multiple S3 buckets using Cloudformation template

Creating Cloudwatch Alarm and pushing the Notifications to Email

Creating Cloudwatch Alarm and pushing the Notifications to Email
  • AWS
logo

How to deploy container image from ECR to EC2 instances using AWS code-deploy agent

How to deploy container image from ECR to EC2 instances using AWS code-deploy agent
  • AWS
logo

How to install apache on ubuntu 20.04 using ansible roles.

How to install apache on ubuntu 20.04 using ansible roles.
  • Apache
logo

Posts by TECH

TECH