- Download and install AWS CLI package from AWS: https://awscli.amazonaws.com/AWSCLIV2.pkg
- Download and install Terraform https://developer.hashicorp.com/terraform/install?product_intent=terraform
- Check that everything is okay:
aws --version
andterraform version
- Create IAM user with the following permission policies:
- AmazonEC2FullAccess
- AmazonRoute53FullAccess
- AmazonS3FullAccess
- IAMFullAccess
- AmazonVPCFullAccess
- AmazonSQSFullAccess
- AmazonEventBridgeFullAccess
- AmazonDynamoDBFullAccess
4.1 Create access keys for user
- Configure AWS CLI credentials by providing access keys by
aws configure
command. Also specify regioneu-east-1
- Create github repository for Terraform code
- Define and apply s3 bucket resource creating for storing terraform state.
- Define and apply dynamo db table creating for implementation of locking mechanism.
NOTE: Do not forget migrate your local state to the remote backend. - Setup OIDC for github actions and AWS:
- Define and apply
aws_iam_openid_connect_provider
resource with all required parameters. - Define and apply IAM role with required federated provider.
- Define and apply IAM permission policies for this role, also add
AmazonDynamoDBFullAccess
IAM permission to have access for operations under dynamoDB lock table.
- Create github workflow:
- Define init, check, plan and apply jobs. Also cache all needed resources.