Prompt Details
Model
Chat - GPT-3.5 (gpt-3.5-turbo)
Token size
160 ($0.00030 / call)
Example input
1. Description: Provisioning a new EC2 instance
2. Technologies or Tools: AWS, Terraform
Example output
```bash
#!/bin/bash
# Description: Provisioning a new EC2 instance
# Set AWS credentials
export AWS_ACCESS_KEY_ID=<your_aws_access_key>
export AWS_SECRET_ACCESS_KEY=<your_aws_secret_access_key>
export AWS_DEFAULT_REGION=<your_aws_default_region>
# Install Terraform if not already installed
if ! command -v terraform &> /dev/null; then
echo "Terraform not found. Installing Terraform..."
wget https://releases.hashicorp.com/terraform/0.14.10/terraform_0.14.10_linux_amd64.zip
unzip terraform_0.14.10_linux_amd64.zip
sudo mv terraform /usr/local/bin/
rm terraform_0.14.10_linux_amd64.zip
fi
# Clone or update the Terraform project
if [ -d "terraform-project" ]; then
echo "Terraform project already exists. Updating..."
cd terraform-project
git pull origin master
else
echo "Cloning Terraform project..."
git clone <terraform_project_repository_url> terraform-project
cd terraform-project
fi
# Initialize and apply Terraform configuration
echo "Initializing Terraform..."
terraform init
echo "Applying Terraform configuration..."
terraform apply -auto-approve
# Retrieve the public IP address of the new instance
instance_ip=$(terraform output -raw instance_ip)
echo "New EC2 instance provisioned successfully."
echo "Public IP: $instance_ip"
```
Please note that the script assumes you have the necessary AWS credentials and permissions to provision EC2 instances using Terraform. Make sure to replace `<your_aws_access_key>`, `<your_aws_secret_access_key>`, `<your_aws_default_region>`, and `<terraform_project_repository_url>` with the appropriate values.
This script automates the process of provisioning a new EC2 instance using Terraform. It checks if Terraform is installed and installs it if necessary. Then, it clones the Terraform project repository or updates it if it already exists. After that, it initializes the Terraform project and applies the configuration to create the EC2 instance. Finally, it retrieves the public IP address of the new instance and displays it as output.
Make sure to run the script in a secure and controlled environment, and follow best practices for handling credentials and sensitive information.
By purchasing this prompt, you agree to our terms of service
GPT-3.5-TURBO
Are you looking to automate your devops process but don't know where to start? This prompt can help!
It will generate a script tailored specifically to your needs, taking into account the specific requirements and environment of your devops process.
So if you're tired of manual work and want to streamline your devops process, order this prompt now and get the perfect script for your needs!
...more
Added over 1 month ago

