DataSunrise is sponsoring RSA Conference2024 in San Francisco, please visit us in DataSunrise's booth #6178

AWS: DataSunrise Configuration with OpenTOFU

AWS: DataSunrise Configuration with OpenTOFU

opentofu aws

Every day companies all over the world tend to lean more and more towards cloud deployment of the software they use. It’s a given, because such a method is cost-efficient and may be easier to manage. But still, the deployment process is not simple. For cloud deployment simplification purposes software like Terraform and its fork OpenTOFU have emerged. In this article we’ll cover integration of DataSunrise with OpenTOFU on Amazon Web Services.

What is OpenTOFU?

OpenTOFU is a fork of Terraform, a program for provisioning and managing infrastructure resources across various cloud providers. In context of OpenTOFU, the term “provider” refers to cloud computing platforms, such as Microsoft Azure or Google Cloud. Terraform simplifies the process of deploying resources, such as virtual machines or databases, down to a couple of command prompts.

OpenTOFU was forked from Terraform in 2021 when Terraform’s developer HashiCorp switched from an open source license to a business source license. It maintains open source policy and is still highly compatible with terraform scripts.

OpenTOFU with AWS

The github repository of OpenTOFU contains a registry of all the supported cloud providers, including Amazon Web Services. This list is used by OpenTOFU during the initialization of deployment. It detects the provider specified in the main.tf file and OS of the host machine, and based on that it downloads the required data for the deployment to start from the specific .json file on the registry repository. The AWS registry file would look like this:

{
"versions": [
{
"version": "5.52.0",
"protocols": [
"5.0"
],
"shasums_url": "https://github.com/opentofu/terraform-provider-aws/releases/download/v5.52.0/terraform-provider-aws_5.52.0_SHA256SUMS",
"shasums_signature_url": "https://github.com/opentofu/terraform-provider-aws/releases/download/v5.52.0/terraform-provider-aws_5.52.0_SHA256SUMS.sig",
"targets": [
{
"os": "darwin",
"arch": "amd64",
"filename": "terraform-provider-aws_5.52.0_darwin_amd64.zip",
"download_url": "https://github.com/opentofu/terraform-provider-aws/releases/download/v5.52.0/terraform-provider-aws_5.52.0_darwin_amd64.zip",
"shasum": "b67098f16684eea8ab3448950c3abe1bebe8d33f2041e228fb75cdac7c3f60af"
},
...

OpenTOFU sends the info about the OS and the required provider and downloads a .zip file accordingly. The rest of the processes go on with the assistance of the downloaded provider.

Deployment of DataSunrise

To ease the deployment experience of the clients, DataSunrise repository provides them with “template Terraform scripts” for each of the supported cloud platforms. For successful deployment, everything from the repository is required to be downloaded and put into tofu folder, but the most important files are “main.tf” and “variables.tf”. The “variables.tf” file is the one that specifies all the settings for deployment and the one user would need to configure. The file looks like this (truncated preview):

variable "deployment_name" {
description = "Name that will be used as the prefix to the resources' names that will be created by the Terraform script (only in lower case, not more than 15 symbols and not less than 5 symbols)"
default   = "xxxxxxxxx"
}
# ------------------------------------------------------------------------------
# Virtual Machine Configuration
# ------------------------------------------------------------------------------

variable "ds_launch_temlate_ec2_keyname" {
description = "Key pair to attach to every EC2 instance created"
default   = "xxxxxxxxx"
}
...

There are 24 variables similar to this in the file dedicated to DataSunrise settings alone, including a target database.

After correctly configuring the file, the changes must be applied to the OpenTOFU CLI.

The Steps for Configuring DataSunrise With OpenTOFU

Before running the obtained scripts, the user must make sure that:

  1. The user has an active DataSunrise License.
  2. The user has an active AWS account.
  3. AWS CLI is installed on the host machine.
  4. OpenTOFU CLI is present of the host machine.
  5. The scripts are located in the OpenTOFU folder and “variables.tf” file is configured correctly.

After that, user must set AWS credentialts to the environment variables in order to authorize OpenTOFU with the AWS account. This is where AWS CLI is needed. Credentials can be set up in the environment variables like this:

set AWS_ACCESS_KEY_ID=********************
set AWS_SECRET_ACCESS_KEY=****************************************
set AWS_DEFAULT_REGION=************

Now OpenTOFU must apply all changes. For that user must run in the tofu directory the following prompts:

tofu init - upgrade

This command downloads the zip archive based on your OS and the required provider with the necessary data for the API to work correctly. The “-upgrade” option looks for the latest verison of the provider. Next command to run:

tofu plan

This command maps out all the actions to be committed by tofu, specified in main.tf file and prints them into console for the user to confirm them.

tofu apply

This command starts the deployment process. OpenTOFU will require additional consent from the user to start it, because cloud services may be quite expensive. Therefore, user must double-check everything while configuring tofu.

Once the process of deployment finishes, tofu will print the required information to start using DataSunrise, such as IP addresses of virtual machines or URL which connects to DS.

If user faces any difficulties, they are encouraged to contact DataSunrise support team at any moment.

OpenTOFU management

For maintenance, the user has the ability to check on each of the resources in the resource group in the AWS account.

In case the need for the configuration is no more, removing it piece by piece manually might be bothersome. OpenTOFU simplifies it too with the command “tofu destroy”. The command completely removes the configuration run by a specific OpenTOFU instance.

Conclusion

The process of DataSunrise deployment using cloud services may be very difficult for an inexperienced user. OpenTOFU simplifies it to the maximum, therefore AWS is not such a big obstacle anymore.

Using the scripts provided by DataSunrise repository you can easily set up the OpenTOFU configuration and deploy the software on AWS in a matter of minutes. And maintenance is just as easy as deployment, because deletion is in one click.

Make sure to contact our team to schedule an online demo or obtain the necessary OpenTOFU scripts for your specific needs. With these scripts and the power of OpenTOFU, deploying DataSunrise on Amazon Web Services becomes a straightforward and efficient process.

Next

DSPM vs. CSPM

DSPM vs. CSPM

Learn More

Need Our Support Team Help?

Our experts will be glad to answer your questions.

General information:
[email protected]
Customer Service and Technical Support:
support.datasunrise.com
Partnership and Alliance Inquiries:
[email protected]