aws cloudformation create-stack --stack-name hogehoge --template-body file://conf.yaml --region ap-northeast-1 --parameters file://param.yaml
-
-
Save jetstreamin/3bb30d9ce970b76fa7122c477536c65e to your computer and use it in GitHub Desktop.
CloudFormation: Postgres with default VPC spike
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: 'AWS CloudFormation Sample Template VPC_RDS_DB_Instance: Sample template | |
showing how to create an RDS DBInstance in an existing Virtual Private Cloud (VPC). | |
**WARNING** This template creates an Amazon Relational Database Service database | |
instance. You will be billed for the AWS resources used if you create a stack from | |
this template.' | |
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) | |
DBName: | |
Default: MyDatabase | |
Description: The database name | |
Type: String | |
MinLength: '1' | |
MaxLength: '64' | |
AllowedPattern: "[a-zA-Z][a-zA-Z0-9]*" | |
ConstraintDescription: must begin with a letter and contain only alphanumeric | |
characters. | |
DBUsername: | |
Default: postgres | |
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: password | |
NoEcho: 'true' | |
Description: The database admin account password | |
Type: String | |
MinLength: '8' | |
MaxLength: '41' | |
AllowedPattern: "[a-zA-Z0-9]*" | |
ConstraintDescription: must contain only alphanumeric characters. | |
DBClass: | |
Default: db.t2.micro | |
Description: Database instance class | |
Type: String | |
AllowedValues: | |
- db.t2.micro | |
- db.t2.small | |
ConstraintDescription: must select a valid database instance type. | |
DBAllocatedStorage: | |
Default: '5' | |
Description: The size of the database (Gb) | |
Type: Number | |
MinValue: '5' | |
MaxValue: '1024' | |
ConstraintDescription: must be between 5 and 1024Gb. | |
Resources: | |
MyDBSubnetGroup: | |
Type: AWS::RDS::DBSubnetGroup | |
Properties: | |
DBSubnetGroupDescription: Subnets available for the RDS DB Instance | |
SubnetIds: | |
Ref: Subnets | |
myVPCSecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Security group for RDS DB Instance. | |
VpcId: | |
Ref: VpcId | |
MyDB: | |
Type: AWS::RDS::DBInstance | |
Properties: | |
DBName: | |
Ref: DBName | |
AllocatedStorage: | |
Ref: DBAllocatedStorage | |
DBInstanceClass: | |
Ref: DBClass | |
Engine: postgres | |
EngineVersion: '9.3' | |
MasterUsername: | |
Ref: DBUsername | |
MasterUserPassword: | |
Ref: DBPassword | |
DBSubnetGroupName: | |
Ref: MyDBSubnetGroup | |
VPCSecurityGroups: | |
- Ref: myVPCSecurityGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- ParameterKey: VpcId | |
ParameterValue: your-vpc-id | |
- ParameterKey: Subnets | |
ParameterValue: your-subnet-id-1, your-subnet-id-2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment