vim terraform/databases/dayone-prod/dayonep_apnortheast2/remote_state.tf
# Set Configuration to use VPC Information via remote_state# VPC backend configuration is located in terraform/variables/var_global.tfdata"terraform_remote_state""vpc"{backend="s3"# merge function is used to merge the key-value pairs from two different mapconfig=merge(var.remote_state.vpc.dayonepapne2,{"role_arn"=var.assume_role_arn} )# You can also set like this. # You should define variables to variables.tf and value of them to terraform.tfvars #config = {# bucket = var.remote_state_bucket# region = var.remote_state_region# key = var.remote_state_key# role_arn = var.assume_role_arn# session_name = var.atlantis_user#}}
파라미터 그룹 생성
아래 표시된 parameter 세팅은 예시입니다.
처음에 모든 parameter 세팅을 하실 필요는 없습니다. Dynamic Parameter는 live인 상태에서 변경이 가능하기 때문에 이후에 변경 가능한 파라미터는 이후에 추가하셔도 됩니다.
첫 생성 이후에 파라미터를 변경하는 경우에는 apply_method 변수를 통해서 적용시점을 지정하실 수 있습니다.
vim terraform/databases/dayone-prod/dayonep_apnortheast2/dayone/parameter_group.tf
# Aurora Parameter Group# This is for the database instance not the cluster.resource"aws_db_parameter_group""dayone_aurora_pg"{name="dayone-aurora-${data.terraform_remote_state.vpc.outputs.shard_id}-pg"# Please change this value to version you want to use family="aurora-mysql5.7"# From this, you could override the default value of DB parameterparameter{# Enable Slow query loggingname="slow_query_log"value="1" }parameter{# Set long query time to 1 second name="long_query_time"value="1" }parameter{# Set DB connection timeout to 5 secondsname="connect_timeout"value="5" }parameter{# Increase the maximum number of connections to 16000 which is the maximum of aurora DB connectionname="max_connections"value=16000 }parameter{# Disable performance schemaname="performance_schema"value=0apply_method="pending-reboot"# Changes applied when DB is rebooted }}# Aurora Cluster Parameter Group# This is for the cluster of instances not the instanceresource"aws_rds_cluster_parameter_group""dayone_aurora_cluster_pg"{name="dayone-aurora-${data.terraform_remote_state.vpc.outputs.shard_id}-cluster-pg"# Please change this value to version you want to use family="aurora-mysql5.7"description="dayone RDS cluster parameter group"parameter{# Set Timezone to Seoulname="time_zone"value="asia/seoul" }parameter{# Enable Slow query Loggingname="slow_query_log"value="1" }parameter{# Set long query time to 1 second name="long_query_time"value="1" }parameter{# Set server collationname="collation_server"value="utf8mb4_bin" }parameter{name="character_set_connection"value="utf8mb4" }parameter{name="character_set_server"value="utf8mb4" }parameter{name="character_set_client"value="utf8mb4" }parameter{name="character_set_database"value="utf8mb4" }parameter{name="collation_connection"value="utf8mb4_bin" }parameter{name="character_set_filesystem"value="utf8mb4" }parameter{name="character_set_results"value="utf8mb4" }parameter{# Increase the maximum number of connections to 16000 which is the maximum of aurora DB connectionname="max_connections"value=16000 }parameter{apply_method="pending-reboot"name="performance_schema"value="0" }parameter{apply_method="pending-reboot"name="query_cache_type"value="0" }parameter{# Set max connection errors to 999999apply_method="immediate"# Changes applied immediatelyname="max_connect_errors"value="999999" }parameter{# Enabled audit loggingapply_method="immediate"name="server_audit_logging"value=1 }}