Infrastructure
Building out your application infrastructure with AI
Summary
Example: Generating a Terraform configuration for an AWS S3 bucket and EC2 instance using generative AI
Prompt
Generate a basic Terraform configuration for an AWS S3 bucket and an EC2 instance.Response
provider "aws" {
region = "us-west-2"
}
resource "aws_s3_bucket" "example_bucket" {
bucket = "my-example-bucket"
acl = "private"
}
resource "aws_instance" "example_instance" {
ami = "ami-0c94855ba95b798c7" # This is an example Amazon Linux 2 AMI ID; replace it with the appropriate AMI ID for your desired instance type and region
instance_type = "t2.micro"
tags = {
Name = "example-instance"
}
}Discussion
Last updated