Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
145 lines (128 sloc) 4.33 KB
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Oracle RDS Template with SSL Option Group",
"Parameters" : {
"VpcId" : {
"Type" : "String",
"Description" : "VpcId of your existing Virtual Private Cloud (VPC)"
},
"Subnets" : {
"Type" : "CommaDelimitedList",
"Description" : "The list of SubnetIds, for at least two Availability Zones in the region in your Virtual Private Cloud (VPC)"
},
"CidrIp" : {
"Type" : "String",
"Description" : "Subnet of who can access 1521 and 2482"
},
"DBName": {
"Default": "orcl",
"Description" : "The database name",
"Type": "String",
"MinLength": "1",
"MaxLength": "8",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DBUsername": {
"Default": "oradba",
"NoEcho": "true",
"Description" : "The database admin account username",
"Type": "String",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DBPassword": {
"Default": "oradba1234",
"NoEcho": "true",
"Description" : "The database admin account password",
"Type": "String",
"MinLength": "8"
},
"DBClass" : {
"Default" : "db.t2.micro",
"Description" : "Database instance class",
"Type" : "String",
"AllowedValues" : [ "db.t2.micro", "db.m1.small", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge" ],
"ConstraintDescription" : "must select a valid database instance type."
},
"DBAllocatedStorage" : {
"Default": "10",
"Description" : "The size of the database (Gb)",
"Type": "Number",
"MinValue": "10",
"MaxValue": "6144",
"ConstraintDescription" : "must be between 10+"
}
},
"Resources" : {
"MyDBSubnetGroup" : {
"Type" : "AWS::RDS::DBSubnetGroup",
"Properties" : {
"DBSubnetGroupDescription" : "Subnets available for the RDS DB Instance",
"SubnetIds" : { "Ref" : "Subnets" }
}
},
"MyDBEC2SecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Frontend Access",
"VpcId" : { "Ref" : "VpcId" },
"SecurityGroupIngress" : [
{
"IpProtocol" : "tcp",
"FromPort" : 1521,
"ToPort" : 1521,
"CidrIp" : { "Ref" : "CidrIp" }
},
{
"IpProtocol" : "tcp",
"FromPort" : 2484,
"ToPort" : 2484,
"CidrIp" : { "Ref" : "CidrIp" }
}
]
}
},
"MyOracleOptionGroup": {
"Type": "AWS::RDS::OptionGroup",
"Properties": {
"EngineName": "oracle-ee",
"MajorEngineVersion": "12.1",
"OptionGroupDescription": "Oracle Option Group with SSL",
"OptionConfigurations":[ {
"OptionName": "SSL",
"VpcSecurityGroupMemberships": [ { "Fn::GetAtt" : [ "MyDBEC2SecurityGroup", "GroupId" ] } ],
"Port": "2484"
} ]
}
},
"MyDB" : {
"Type" : "AWS::RDS::DBInstance",
"Properties" : {
"DBName" : { "Ref" : "DBName" },
"AllocatedStorage" : { "Ref" : "DBAllocatedStorage" },
"DBInstanceClass" : { "Ref" : "DBClass" },
"Engine" : "oracle-ee",
"EngineVersion": "12.1",
"MasterUsername" : { "Ref" : "DBUsername" } ,
"MasterUserPassword" : { "Ref" : "DBPassword" },
"DBSubnetGroupName" : { "Ref" : "MyDBSubnetGroup" },
"OptionGroupName" : {"Ref" : "MyOracleOptionGroup" },
"VPCSecurityGroups" : [ { "Fn::GetAtt" : [ "MyDBEC2SecurityGroup", "GroupId" ] } ]
}
}
},
"Outputs" : {
"JDBCConnectionString": {
"Description" : "JDBC connection string for database",
"Value" : { "Fn::Join": [ "", [ "jdbc:oracle://",
{ "Fn::GetAtt": [ "MyDB", "Endpoint.Address" ] },
":",
{ "Fn::GetAtt": [ "MyDB", "Endpoint.Port" ] },
"/",
{ "Ref": "DBName" }]]}
}
}
}