Skip to content

Instantly share code, notes, and snippets.

@inoh
Last active February 27, 2022 17:46
Show Gist options
  • Save inoh/3390c835fcd642645d20f5ade92abcd2 to your computer and use it in GitHub Desktop.
Save inoh/3390c835fcd642645d20f5ade92abcd2 to your computer and use it in GitHub Desktop.
bucket = s3.Bucket(self,
'S3',
bucket_name='diary.ino-h.com',
website_index_document='index.html',
removal_policy=core.RemovalPolicy.DESTROY,
)
s3_deployment.BucketDeployment(self,
'Deployment',
sources=[s3_deployment.Source.asset('build')],
destination_bucket=bucket,
)
distribution = cloudfront.Distribution(self,
'CloudFront',
default_behavior={
'origin': origins.S3Origin(bucket),
},
)
repository = ecr.Repository.from_repository_name(self,
'Repository',
repository_name='atd-api',
)
handler = lambda_.DockerImageFunction(self,
'Function',
function_name=self.stack_name,
code=lambda_.DockerImageCode.from_ecr(repository),
environment={
'FRONTEND_ORIGIN': f'https://{distribution.domain_name}',
},
initial_policy=self.lambda_policies(),
)
integration = apigatewayv2_integrations.LambdaProxyIntegration(
handler=handler,
)
api = apigatewayv2.HttpApi(self, 'HttpApi')
api.add_routes(
path='/{proxy+}',
methods=[ apigatewayv2.HttpMethod.ANY ],
integration=integration,
)
@inoh
Copy link
Author

inoh commented Jan 26, 2021

vpc = aws_ec2.Vpc(scope, 'EC2Vpc')

aws_ec2.BastionHostLinux(scope, "bastion",
    vpc=vpc,
    instance_name="bastion",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment