惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
罗磊的独立博客
The GitHub Blog
The GitHub Blog
L
LangChain Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
DataBreaches.Net
宝玉的分享
宝玉的分享
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
N
Netflix TechBlog - Medium
The Cloudflare Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
美团技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Creating AWS S3 Bucket using Terraform
Brian Mengo · 2026-04-26 · via DEV Community

Introduction
The first resource I create and provision using terraform is the AWS S3 bucket. By writing terraform configuration files (.tf files) to initialise providers and use terraform commands to interact with AWS APIs and provision resources.

AWS CLI for credentials setup before creating any resource in AWS using aws configure.
The below image shows the procedure of provisioning a simple S3 Bucket.

Terraform Configuration
The set up for this resource involves only two block: the provider configuration block and the S3 bucket resource block

The Provider Block
Since we are using the AWS provider we setup by specifying the region in which the resource will be created

provider "aws" {
  region = "us-east-1"
}

Enter fullscreen mode Exit fullscreen mode

S3 Bucket Resource Block

resource "aws_s3_bucket" "demo_bucket" {
  bucket = "devbrio53-store"

  tags = {
    Name        = "My bucket"
    Environment = "Dev"
  }
}

Enter fullscreen mode Exit fullscreen mode

The Terraform resource block starts with the keyword resource, followed by the resource type aws_s3_bucket and a user-defined resource name (e.g., first_bucket).

The bucket name must be globally unique across AWS regions.

Tags are added as a nested block with key-value pairs, e.g., Name and Environment
Tags are strings enclosed in double quotes and enclosed within curly braces, representing a map/dictionary data type in Terraform.

Using Terraform AWS provider documentation to find the correct resource block for an S3 bucket (aws_s3_bucket).
The documentation provides example usage, argument references (mandatory and optional parameters), and guides how to customise the resource block.

Running Terraform Commands to Provision the Bucket

Terraform initialisation is run using the command:

terraform init

Enter fullscreen mode Exit fullscreen mode

This downloads the necessary provider plugins and initialises the backend.

Next, a plan is created using:

terraform plan

Enter fullscreen mode Exit fullscreen mode

This performs a dry run to preview the changes Terraform will apply without actually creating or modifying resources.

The command to apply the changes and create the bucket is:

terraform apply

Enter fullscreen mode Exit fullscreen mode

Terraform prompts for confirmation before applying changes; typing yes proceeds with the creation.

Running terraform plan again shows

  • Zero resources to add
  • One resource to change
  • Zero resources to destroy

Terraform performs a state comparison between the current AWS environment and the configuration file to detect changes.

To delete the created bucket and clean up resources, the command is:

terraform destroy

Enter fullscreen mode Exit fullscreen mode

This removes everything created by the Terraform configuration. It’s a handy way to keep your AWS account clean while learning.

Today’s learning wasn’t just about creating an S3 bucket.

It was about understanding how Terraform connects with AWS, and why authentication is the foundation of everything in cloud.

A simple bucket but a meaningful step forward.