Skip to content

Instantly share code, notes, and snippets.

View prasitstk's full-sized avatar
🏠
Working from home

Prasit Sutthikamolsakul prasitstk

🏠
Working from home
View GitHub Profile
@prasitstk
prasitstk / share-automated-default-encrypted-pg-rds-snapshot-across-accounts.tf
Last active February 8, 2026 19:59
Share automated PostgreSQL DB instance snapshot with default encryption across accounts
#################
# Configuration #
#################
locals {
src_aws_region = "<source-snapshot-account-aws-region>"
src_aws_access_key = "<source-snapshot-account-aws-access-key>"
src_aws_secret_key = "<source-snapshot-account-aws-secret-key>"
tgt_aws_region = "<targer-account-aws-region>"
tgt_aws_access_key = "<target-account-aws-access-key>"
@prasitstk
prasitstk / share-custom-ami-across-accounts.tf
Last active February 8, 2026 20:29
Share a custom AMI across accounts (shared from the source account and used by the target account)
#################
# Configuration #
#################
locals {
src_aws_region = "<source-ami-account-aws-region>"
src_aws_access_key = "<source-ami-account-aws-access-key>"
src_aws_secret_key = "<source-ami-account-aws-secret-key>"
tgt_aws_region = "<targer-account-aws-region>"
tgt_aws_access_key = "<target-account-aws-access-key>"
@prasitstk
prasitstk / iam-groups-cross-account-access.tf
Last active February 8, 2026 20:26
Create IAM Groups of a member account to be allowed to assume from IAM Users of a management account
#################
# Configuration #
#################
locals {
mgmt_aws_access_key = "<your-aws-access-key-on-management-account>"
mgmt_aws_secret_key = "<your-aws-secret-key-on-management-account>"
mgmt_admin_iam_grp_name = "Administrators"
mgmt_dev_iam_grp_name = "Developers"
tgt_root_user_aws_access_key = "<your-root-user-aws-access-key-on-target-member-account>"
@prasitstk
prasitstk / set-up-aws-backup-ec2-instances-based-on-tags-with-terraform.tf
Last active February 8, 2026 20:30
Set up AWS Backup for EC2 instances based on their tags with Terraform
#################
# Configuration #
#################
locals {
aws_region = "<your-aws-region>"
aws_access_key = "<your-aws-access-key>"
aws_secret_key = "<your-aws-secret-key>"
sys_name = "<sys-name>"
sys_ami_id = "ami-xxx" # AMI ID of the base image for created EC2 instances for this demonstration
@prasitstk
prasitstk / migrate-git-repository-from-github-to-aws-codecommit-with-terraform.tf
Last active February 8, 2026 20:30
Migrate Git repository from GitHub to AWS CodeCommit with Terraform
#################
# Configuration #
#################
locals {
aws_region = "<your-aws-region>"
aws_access_key = "<your-aws-access-key>"
aws_secret_key = "<your-aws-secret-key>"
src_repo_url = "https://github.com/<github-username>/<repository.git>"
tgt_codecommit_repo_name = "<target-codecommit-repo-name>"
@prasitstk
prasitstk / managing-terraform-s3-backend-in-the-same-configuration.tf
Last active November 13, 2022 23:26
Managing Terraform S3 backend in the same configuration
#################
# Configuration #
#################
locals {
aws_access_key = "<your-aws-access-key>"
aws_secret_key = "<your-aws-secret-key>"
}
#############
@prasitstk
prasitstk / creating-your-first-iam-admin-user-and-user-group-using-terraform.tf
Last active November 13, 2022 23:24
Creating your first IAM admin user and user group using terraform
#################
# Configuration #
#################
locals {
root_user_aws_access_key = "<your-root-user-aws-access-key>"
root_user_aws_secret_key = "<your-root-user-aws-secret-key>"
admin_iam_grp_name = "Administrators"
pgp_key_binary_file_path = "/path/to/your/admin-public-key-binary.gpg"
ssh_public_key_file_path = "/path/to/your/admin-ssh-key_rsa.pub"