DEV Community

Cover image for Configuring AWS with terraform using Ubuntu
Tolulope Adeleke
Tolulope Adeleke

Posted on

Configuring AWS with terraform using Ubuntu

Hello there πŸ™‹β€β™€οΈ

I will be sharing the basic steps on how to configure AWS with terraform using Ubuntu. If you're a beginner, this will definitely save you some time and energy.

Here we go... Yayyy

Hey...You need to have an AWS account you might want to try the free access account as a beginner.

You need to download your VMware workstation pro (Make sure it is the latest version of Ubuntu). It is quite heavy and takes a very long time to download and install this.

Make sure to remember your Credentials (Username and Password) while installing your VMware. Note, this is very important

You should get this after installation

It starts from here;

Image description

and ends here...

Image description

If you follow this steps clearly, you should get terraform installed on your VMware workstation pro. Here are the steps in order;

On your platform, search for terminal then click on it to get started. Now run the following commands;

1. wget https://releases.hashicorp.com/terraform/1.1.3/terraform_1.1.3_linux_amd64.zip (always confirm the latest version)

2. sudo apt-get install zip -y (Sudo means superuser do or substitute user do)

3. unzip terraform*.zip

4.sudo mv terraform /usr/local/bin

5. terraform --version or terraform -v (this will give you the version of terraform you installed)

6. mkdir /terraform (this has to do with directory)

7. cd /terraform

8. vim config.tf

You should get this after running those commands;

Image description

If you have gotten this far...Kudos

9. You have to fill this in for configuration

provider "aws" {
project = "my-project-id"
region = "us-central1"
}

You can leave the page by clicking on (esc ,then shift and : then type wq) with this you can leave the page, so as to go back to continue with deployment.

10. Now run terraform innit

Now log in to the AWS Management Console click on your name on the dashboard, scroll down to security credentials. Copy the Access keys(access key ID and secret access key)

Image description

Image description

11. sudo snap install aws-cli --classic

12. aws configure

fill all the required credentials here (credentials from step 10)

13. mkdir /terraform

14. cd /terraform

15. touch main.tf

Make sure to fill in this command, it should appear like
this

terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"

}
}
required_version = ">= 0.14.9"
}

provider "aws" {
profile = "default"
region = "us-west-2"

}
resource "s3 bucket" "tolubucket" {
bucket = "clouddeveloper"
acl = private

tags = {
Name = "storage bucket"
}
}

16. Now run terraform innit

17. terraform plan

18. terraform apply

Now go to your AWS Console to check your deployment

That is all!

Image description

well done... If you have gotten this far, Kudos.

See you on my next blogπŸ‘Š There is a section 2 for this

Top comments (0)