-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4410d4b
commit ffabbcb
Showing
4 changed files
with
73 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 1,41 @@ | ||
from aws_cdk import core | ||
from aws_cdk import core, \ | ||
aws_s3 as s3, \ | ||
aws_ec2 as ec2, \ | ||
aws_kms as kms, \ | ||
aws_rds as rds | ||
from aws_cdk.aws_ec2 import Peer, Port | ||
from aws_cdk.aws_rds import PostgresEngineVersion | ||
from aws_cdk.core import RemovalPolicy | ||
|
||
|
||
class CdkgoatStack(core.Stack): | ||
class CdkGoatStack(core.Stack): | ||
|
||
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None: | ||
super().__init__(scope, id, **kwargs) | ||
|
||
# The code that defines your stack goes here | ||
vpc = ec2.Vpc(self, | ||
'vpc1' | ||
) | ||
|
||
bucket_name = 'my-cdk-bucket' | ||
s3.Bucket(self, | ||
bucket_name, | ||
bucket_name=bucket_name, | ||
access_control=s3.BucketAccessControl.PUBLIC_READ_WRITE, | ||
removal_policy=RemovalPolicy.DESTROY) | ||
|
||
ec2.Volume(self, 'vol1', availability_zone='us-east-1a', size=core.Size.gibibytes(8)) | ||
|
||
sg = ec2.SecurityGroup(self, | ||
'sg1', | ||
vpc=vpc) | ||
sg.add_ingress_rule(Peer.any_ipv4(), Port.tcp(22)) | ||
|
||
kms.Key(self, 'kms1') | ||
|
||
rds.DatabaseInstance(self, | ||
'rds1', | ||
engine=rds.DatabaseInstanceEngine.postgres(version=PostgresEngineVersion.VER_12), | ||
master_username='root', | ||
vpc=vpc, | ||
vpc_placement=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC)) |
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