Terraform is an infrastructure orchestration tool for creating web
services in AWS automatically. You can use Terraform for provisioning S3
bucket in AWS.
sudo vi create_s3.tf
resource "aws_s3_bucket" "mybucket" {
bucket = "my-tf-test-bucket"
acl = "public-read"
website {
index_document = "hello.html"
routing_rules = <<EOF
[{
"Condition": {
"KeyPrefixEquals": "docs/"
},
"Redirect": {
"ReplaceKeyPrefixWith": "documents/"
}
}]
EOF
}
tags {
Name = "My bucket"
Environment = "Dev"
}
}
Once you create the above file, execute terraform plan and then terraform apply to create S3 bucket in AWS.
sudo vi create_s3.tf
resource "aws_s3_bucket" "mybucket" {
bucket = "my-tf-test-bucket"
acl = "public-read"
website {
index_document = "hello.html"
routing_rules = <<EOF
[{
"Condition": {
"KeyPrefixEquals": "docs/"
},
"Redirect": {
"ReplaceKeyPrefixWith": "documents/"
}
}]
EOF
}
tags {
Name = "My bucket"
Environment = "Dev"
}
}
Once you create the above file, execute terraform plan and then terraform apply to create S3 bucket in AWS.
Great collection and thanks for sharing this info with us. Waiting for more like this.
ReplyDeleteAWS Training in Chennai
AWS Certification in Chennai
Cloud Training in Chennai
Cloud Computing Courses in Chennai
Azure Training in Chennai
Microsoft Azure Training in Chennai
DevOps course in Chennai
Cloud Computing Courses in Chennai
Great Article Cloud Computing Projects
ReplyDeleteNetworking Projects
Final Year Projects for CSE
JavaScript Training in Chennai
JavaScript Training in Chennai
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training