Last active
February 27, 2022 17:46
-
-
Save inoh/3390c835fcd642645d20f5ade92abcd2 to your computer and use it in GitHub Desktop.
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
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, | |
) |
Author
inoh
commented
Jan 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment