kfs_rds_instance.yaml
---

KFS RDS Instance

This CloudFormation template will build an RDS Instance

AWSTemplateFormatVersion: '2010-09-09' Description: KFS RDS Instance

Parameters

These are the input parameters for this template. All of these parameters must be supplied for this template to be deployed.

Parameters: EnvSlug: MinLength: '2' Type: String Description: Short environment slug, ie 'dev', or 'markdev'. Lowercase letters, numbers and dashes only AllowedPattern: "[a-z0-9]*" AppDBServicename: Description: Database Service Name Type: String DBSnapshotID: Description: DB Snapshot ID Type: String DBInstClass: Description: DB Snapshot ID Type: String Default: "db.m4.large" DBFinalSnapshot: Description: Take a final snapshot when DB is removed Type: String Default: "Y" TagService: Description: Service name (from the service catalog) that is utilizing this resource Type: String TagName: Description: Descriptive identifier of resource. Type: String TagEnvironment: Description: Type of environment that is using this resource, such as 'dev', 'tst', 'prd'. Type: String TagCreatedBy: Description: NetID of the user that created this resource Type: String TagContactNetId: Description: NetID of the person to contact for information about this resource Type: String TagAccountNumber: Description: Financial system account number for the service utilizing this resource Type: String TagSubAccount: Description: Financial system subaccount number for the service utilizing this resource Type: String TagTicketNumber: Description: Ticket number that this resource is for Type: String TagResourceFunction: Description: Human-readable description of what function this resource is providing Type: String Conditions: IsHAEnv: !Equals [!Ref EnvSlug, "prd"] FinalSnapshot: !Equals [!Ref DBFinalSnapshot, "Y"] NoFinalSnapshot: !Not [!Equals [!Ref DBFinalSnapshot, "Y"]]

Resources

These are all of the actual AWS resources created for this application.

Resources: #RDS Instance for Environment DBInstanceFinalSnapshot: Type: AWS::RDS::DBInstance Condition: FinalSnapshot Properties: DBInstanceIdentifier: !Ref "AppDBServicename" DBName: !Ref "AppDBServicename" DBSnapshotIdentifier: !Ref "DBSnapshotID" MultiAZ: !If ["IsHAEnv","true","false"] Engine: "oracle-ee" LicenseModel: "bring-your-own-license" DBInstanceClass: !Ref "DBInstClass" DBParameterGroupName: !ImportValue "kfs-rds-parameter-group-DbParamGroup" OptionGroupName: !ImportValue "Kuali-Rds-Option-Group-DbOptionGroup" StorageType: "gp2" DBSubnetGroupName: "kuali-subnet-group" VPCSecurityGroups: - !ImportValue "Kuali-DbSg-DbSecurityGroup" Tags: - Key: service Value: !Ref TagService - Key: Name Value: !Sub "${TagName}-db-instance" - Key: environment Value: !Ref TagEnvironment - Key: createdby Value: !Ref TagCreatedBy - Key: contactnetid Value: !Ref TagContactNetId - Key: accountnumber Value: !Ref TagAccountNumber - Key: subaccount Value: !Ref TagSubAccount - Key: ticketnumber Value: !Ref TagTicketNumber - Key: resourcefunction Value: !Ref TagResourceFunction #This will create a final snapshot when the database is removed DeletionPolicy: "Snapshot" #This DB instance will be created with the the policy to not create a final snapshot #Will be used in enviornments like SUP were we don't need one DBInstanceNoFinalSnapshot: Type: AWS::RDS::DBInstance Condition: NoFinalSnapshot Properties: DBInstanceIdentifier: !Ref "AppDBServicename" DBName: !Ref "AppDBServicename" DBSnapshotIdentifier: !Ref "DBSnapshotID" MultiAZ: !If ["IsHAEnv","true","false"] Engine: "oracle-ee" LicenseModel: "bring-your-own-license" DBInstanceClass: !Ref "DBInstClass" DBParameterGroupName: !ImportValue "kfs-rds-parameter-group-DbParamGroup" OptionGroupName: !ImportValue "Kuali-Rds-Option-Group-DbOptionGroup" StorageType: "gp2" DBSubnetGroupName: "kuali-subnet-group" VPCSecurityGroups: - !ImportValue "Kuali-DbSg-DbSecurityGroup" Tags: - Key: service Value: !Ref TagService - Key: Name Value: !Sub "${TagName}-db-instance" - Key: environment Value: !Ref TagEnvironment - Key: createdby Value: !Ref TagCreatedBy - Key: contactnetid Value: !Ref TagContactNetId - Key: accountnumber Value: !Ref TagAccountNumber - Key: subaccount Value: !Ref TagSubAccount - Key: ticketnumber Value: !Ref TagTicketNumber - Key: resourcefunction Value: !Ref TagResourceFunction #This will create a final snapshot when the database is removed DeletionPolicy: "Delete"