1. Free tier AWS account with IAM user with Admin access
2. Access key and secret key of IAM user
3. AWS CLI configured with Access/Secret key, region(us-east-1) and json format
4. In GitBash run "mkdir -p ~/export/DevOps" to check if folder is created
5. GitLab account with "DevOps" group
6. Copy local public key to GitLab - Profile_Settings - SSH Key - Add_NewKey
7. Create Global variables in GitLab - Groups - DevOps - Settings - CI/CD
8. Add new variables for access_key, secret_key and region in Variables section
9. Copy the "aws-tf-vpc-ec2-main.zip" to your "~/export/DevOps" folder
10. Unzip the file from GitBash - “unzip aws-tf-vpc-ec2-main.zip”. You should run from “~/export/DevOps” folder
11. Create a new repository in GitLab - under DevOps group - aws-tf-vpc-ec2
12. Copy the repo link from GitLab - Code - Clone with SSH - Copy the link
13. Do a git clone in GitBash - git clone $repo_link
14. Then go to aws-tf-vpc-ec2 folder
15. Copy all the files/folders from -main folder. cp -r ../aws-tf-vpc-ec2-main/* .
16. Copy the .gitignore file from -main folder. cp ../aws-tf-vpc-ec2-main/.* .
17. Change variables according to your local env
18. Do git add ., git commit -m "Your commit message" and git push
19. Observe the changes done on the GitLab repository
20. Run terraform init from "~/export/DevOps/aws-tf-vpc-ec2" folder
21. Run "terraform validate", terraform plan and terraform apply commands
22. Check AWS console for EC2 instance creation
23. Run terraform destroy to remove the EC2 instance
15 окт 2024