diff --git a/templates/containers/ecr.yml b/templates/containers/ecr.yml index 2a51521..aaa42db 100644 --- a/templates/containers/ecr.yml +++ b/templates/containers/ecr.yml @@ -15,8 +15,8 @@ Metadata: - Label: default: 'ECR Configuration' Parameters: - - BackEndAppRepositorySuffix - - BackEndWebRepositorySuffix + - BackendAppRepositorySuffix + - BackendWebRepositorySuffix # ------------------------------------- # Input parameters @@ -36,11 +36,11 @@ Parameters: - stg - prd ConstraintDescription: 'Environment must be select.' - BackEndAppRepositorySuffix: + BackendAppRepositorySuffix: Description: 'Repository name suffix of the application container image. (ex: django)' Type: String Default: django - BackEndWebRepositorySuffix: + BackendWebRepositorySuffix: Description: 'Repository name suffix of the webserver container image. (ex: nginx)' Type: String Default: nginx @@ -54,7 +54,7 @@ Resources: UpdateReplacePolicy: Retain Type: AWS::ECR::Repository Properties: - RepositoryName: !Sub ${ProjectName}/${Environment}/back/${BackEndAppRepositorySuffix} + RepositoryName: !Sub ${ProjectName}/${Environment}/back/${shun198} ImageScanningConfiguration: ScanOnPush: true ImageTagMutability: IMMUTABLE @@ -68,7 +68,7 @@ Resources: UpdateReplacePolicy: Retain Type: AWS::ECR::Repository Properties: - RepositoryName: !Sub ${ProjectName}/${Environment}/back/${BackEndWebRepositorySuffix} + RepositoryName: !Sub ${ProjectName}/${Environment}/back/${BackendWebRepositorySuffix} ImageScanningConfiguration: ScanOnPush: true ImageTagMutability: IMMUTABLE diff --git a/templates/environment/dev.yml b/templates/environment/dev.yml index 34a99c5..2b89597 100644 --- a/templates/environment/dev.yml +++ b/templates/environment/dev.yml @@ -347,7 +347,7 @@ Parameters: Default: 2 AllowedValues: [0, 1, 2] RDSDBName: - Description: "Enter the database name (ex: factor_flow_master_development)" + Description: "Enter the database name (ex: shun198_development)" Type: String RDSDBMasterUserName: Description: "Enter the master username (postgres)" @@ -358,7 +358,7 @@ Parameters: AllowedPattern: "^[a-zA-Z][a-zA-Z_0-9]*" ConstraintDescription: "Must begin with a letter and contain only alphanumeric characters" RDSDBMasterUserPassword: - Description: "Enter the master password (postgres)" + Description: "Enter the master password (Postgres123)" Type: String NoEcho: true MinLength: 10 diff --git a/templates/logs/cloudwatch-logs-for-ecs.yml b/templates/logs/cloudwatch-logs-for-backend.yml similarity index 56% rename from templates/logs/cloudwatch-logs-for-ecs.yml rename to templates/logs/cloudwatch-logs-for-backend.yml index 75b2f2c..6151c84 100644 --- a/templates/logs/cloudwatch-logs-for-ecs.yml +++ b/templates/logs/cloudwatch-logs-for-backend.yml @@ -1,17 +1,6 @@ AWSTemplateFormatVersion: 2010-09-09 Description: "CloudWatch Logs Stack For Backend" -# ------------------------------------- -# Mappings -# ------------------------------------- -Mappings: - # ロググループの保持期間 - RetentionInDaysMap: - Environment: - dev: 30 - stg: 60 - prd: 90 - # ------------------------------------- # Metadata # ------------------------------------- @@ -25,35 +14,41 @@ Metadata: - ProjectName - Environment - Label: - default: "CloudWatch Logs Configuration for ECS" + default: "CloudWatch Logs Configuration for ECS Fargate" Parameters: - - AppLogGroupName - - WebLogGroupName + - BackendAppLogGroupName + - BackendWebLogGroupName + - LogRetentionInDays # ------------------------------------- -# Input parameters +# Parameters # ------------------------------------- Parameters: ProjectName: Description: "Enter the project name. (ex: shun198)" Type: String MinLength: 1 - ConstraintDescription: "ProjectName must be enter." + ConstraintDescription: "ProjectName must be entered." Default: shun198 Environment: - Description: "Select the environment." + Description: "Select the environment name." Type: String AllowedValues: - dev - stg - prd - ConstraintDescription: "Environment must be select." - AppLogGroupName: - Description: "CloudWatch Logs log-group name for application. (ex: /ecs/shun198/dev/back/django)" + ConstraintDescription: "Environment name must be selected." + BackendAppLogGroupName: + Description: "CloudWatch Logs log-group name for application. (ex: /ecs/shun198//back/django)" + Type: String + BackendWebLogGroupName: + Description: "CloudWatch Logs log-group name for webserver. (ex: /ecs/shun198//back/nginx)" Type: String - WebLogGroupName: - Description: "CloudWatch Logs log-group name for webserver. (ex: /ecs/shun198/dev/back/nginx)" + LogRetentionInDays: + Description: "Enter the data retention period." Type: String + Default: 30 + AllowedValues: [30, 60, 90] # ------------------------------------- # Resources @@ -68,9 +63,8 @@ Resources: UpdateReplacePolicy: Retain Type: AWS::Logs::LogGroup Properties: - LogGroupName: !Ref AppLogGroupName - RetentionInDays: - !FindInMap [RetentionInDaysMap, Environment, !Ref Environment] + LogGroupName: !Ref BackendAppLogGroupName + RetentionInDays: !Ref LogRetentionInDays Tags: - Key: ProjectName Value: !Ref ProjectName @@ -82,11 +76,25 @@ Resources: UpdateReplacePolicy: Retain Type: AWS::Logs::LogGroup Properties: - LogGroupName: !Ref WebLogGroupName - RetentionInDays: - !FindInMap [RetentionInDaysMap, Environment, !Ref Environment] + LogGroupName: !Ref BackendWebLogGroupName + RetentionInDays: !Ref LogRetentionInDays Tags: - Key: ProjectName Value: !Ref ProjectName - Key: Environment Value: !Ref Environment + + # ------------------------------------- + # Metric Filter + # ------------------------------------- + ErrorInBackendWebLogs: + Type: AWS::Logs::MetricFilter + DependsOn: LogGroupForWeb + Properties: + LogGroupName: !Ref BackendWebLogGroupName + FilterPattern: ?"[error]" ?"[crit]" ?"[alert]" ?"[emerg]" + MetricTransformations: + - DefaultValue: 0 + MetricValue: 1 + MetricNamespace: Backend/Logs + MetricName: ErrorInBackendWebLogs