Here is the code snippets for MS SQL deployment using YML code in AWS. If you wish to make it AD integrated then review the details given in comment section.
AWSTemplateFormatVersion: '2010-09-09' Description: Creates an empty SQL Server RDS database as an example for automated deployments. Parameters: SqlServerInstanceName: NoEcho: 'false' Description: RDS SQL Server Instance Name Type: String Default: MyAppInstance MinLength: '1' MaxLength: '63' AllowedPattern: "[a-zA-Z][a-zA-Z0-9]*" DatabaseUsername: AllowedPattern: "[a-zA-Z0-9]+" ConstraintDescription: DBAdmin Description: Database Admin Account User Name MaxLength: '16' MinLength: '1' Type: String Default: 'DBAdmin' DatabasePassword: AllowedPattern: "^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)" ConstraintDescription: Must contain only alphanumeric characters with at least one capital letter and one number. Description: The database admin account password. MaxLength: '41' MinLength: '6' NoEcho: 'true' Type: String Default: Admin123 DBEngine: Description: Select Database Engine Type: String AllowedValues: [Express, Enterprise] #Following paramter can be placed if SQL needs to be AD integrated. #DomainID: # Description: Enter the Domain ID # Type: String Mappings: SQLTOEngineType: Express: Engine: sqlserver-ex Enterprise: Engine: sqlserver-ee Resources: SQLDatabase: Type: AWS::RDS::DBInstance Properties: DBInstanceIdentifier: Ref: SqlServerInstanceName LicenseModel: license-included Engine: !FindInMap [SQLTOEngineType, !Ref 'DBEngine', Engine] EngineVersion: 13.00.4466.4.v1 DBInstanceClass: db.t2.micro AllocatedStorage: '20' MasterUsername: Ref: DatabaseUsername MasterUserPassword: Ref: DatabasePassword PubliclyAccessible: 'true' BackupRetentionPeriod: '1' #If SQL RDS needs to Active Directory Integrated then uncomment following parameter. #Domain: !ImportValue Directory-ID #OR #!Ref DomainID #IAM role is mandate for AD integration #DomainIAMRoleName: 'rds-directoryservice-access-role' Outputs: SQLDatabaseEndpoint: Description: Database endpoint Value: !Sub "${SQLDatabase.Endpoint.Address}:${SQLDatabase.Endpoint.Port}"
- Save above code in SQLRDS.YML file.
- Open AWS management console, In Cloud formation section, select New Template, select Upload a template to Amazon S3. Select SQLRDS.YML file then follow the wizard with all default options.
- Once deployment successfully completes, you would see events like below screenshot.
You must be logged in to post a comment.