Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cloudfront): function URL origin access control L2 construct #31339

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bc5f929
oac
watany-dev Sep 6, 2024
80f07f7
wip: oac fin
watany-dev Sep 6, 2024
a6386c1
oai
watany-dev Sep 6, 2024
da605ea
fix oai
watany-dev Sep 6, 2024
b2baafa
remove oai
watany-dev Sep 7, 2024
5a7352a
snapshoted
watany-dev Sep 7, 2024
8e8e2ac
Merge branch 'main' into lambda-url-oac
watany-dev Sep 7, 2024
7fcbea3
fix doctest
watany-dev Sep 7, 2024
12f13f9
Merge branches 'lambda-url-oac' and 'lambda-url-oac' of https://githu…
watany-dev Sep 7, 2024
b257227
snapshotted
watany-dev Sep 7, 2024
8f24a4a
fix doctest
watany-dev Sep 7, 2024
81c0785
fixed
watany-dev Sep 7, 2024
47775c8
refactor
watany-dev Sep 8, 2024
df0c972
Merge branch 'main' into lambda-url-oac
watany-dev Sep 8, 2024
a43bf40
hide private class
watany-dev Sep 10, 2024
3731370
nest the new tests under a new describe
watany-dev Sep 10, 2024
f660a83
just leave out the props altogether
watany-dev Sep 10, 2024
2ad9170
to private method
watany-dev Sep 10, 2024
989141b
we also check the AWS::Lambda::Permission resource exists in the temp…
watany-dev Sep 10, 2024
7226680
we handle permissions for imported lambda functions
watany-dev Sep 10, 2024
7f9ba73
re integtest
watany-dev Sep 11, 2024
a577a65
re integ
watany-dev Sep 11, 2024
beeb0f4
fix
watany-dev Sep 12, 2024
c129a19
Merge branch 'main' into lambda-url-oac
watany-dev Sep 12, 2024
64c92a7
Merge branch 'aws:main' into lambda-url-oac
watany-dev Sep 13, 2024
ad5778d
update integ
watany-dev Sep 13, 2024
5802d54
Merge branch 'main' into lambda-url-oac
watany-dev Sep 13, 2024
258e464
update the url to lambdaFunctionUrl
watany-dev Sep 26, 2024
8ada469
props?.originAccessControl
watany-dev Sep 26, 2024
d8b0b16
refactor test case
watany-dev Sep 26, 2024
1e4983b
test case that accepts only fnUrl
watany-dev Sep 26, 2024
16eb227
fixed
watany-dev Sep 26, 2024
693abfe
Merge branch 'main' into lambda-url-oac
watany-dev Sep 26, 2024
92f7e71
revert this.oac
watany-dev Sep 27, 2024
adc12d3
integ
watany-dev Sep 27, 2024
e4817ff
Authtype.None
watany-dev Sep 27, 2024
fd9f9b4
Split OAC Configuration Test for Default and Custom Signing Behavior
watany-dev Sep 28, 2024
fea5a32
split integ
watany-dev Sep 28, 2024
873777b
update integ
watany-dev Sep 28, 2024
fcf8db0
update doc
watany-dev Oct 1, 2024
2375bcd
remove duplicate test
watany-dev Oct 1, 2024
a6f5726
Merge branch 'aws:main' into lambda-url-oac
watany-dev Oct 5, 2024
fce4e73
adding warning
watany-dev Oct 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
{
"Resources": {
"MyFunctionServiceRole3C357FF2": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"MyFunction3BAA72D1": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "\n exports.handler = async () => ({\n statusCode: 200,\n body: 'Hello!!'\n });\n "
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyFunctionServiceRole3C357FF2",
"Arn"
]
},
"Runtime": "nodejs20.x"
},
"DependsOn": [
"MyFunctionServiceRole3C357FF2"
]
},
"MyFunctionFunctionUrlFF6DE78C": {
"Type": "AWS::Lambda::Url",
"Properties": {
"AuthType": "AWS_IAM",
"TargetFunctionArn": {
"Fn::GetAtt": [
"MyFunction3BAA72D1",
"Arn"
]
}
}
},
"CustomOACCBB5FFDD": {
"Type": "AWS::CloudFront::OriginAccessControl",
"Properties": {
"OriginAccessControlConfig": {
"Name": "CustomLambdaOAC",
"OriginAccessControlOriginType": "lambda",
"SigningBehavior": "always",
"SigningProtocol": "sigv4"
}
}
},
"DistributionOrigin1InvokeFromApiForintegcloudfrontfunctionurlorigincustomoacDistributionOrigin187E79A3C7850B1CA": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunctionUrl",
"FunctionName": {
"Fn::GetAtt": [
"MyFunctionFunctionUrlFF6DE78C",
"FunctionArn"
]
},
"Principal": "cloudfront.amazonaws.com",
"SourceArn": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":cloudfront::",
{
"Ref": "AWS::AccountId"
},
":distribution/",
{
"Ref": "Distribution830FAC52"
}
]
]
}
}
},
"Distribution830FAC52": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "integcloudfrontfunctionurlorigincustomoacDistributionOrigin187E79A3C",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only",
"OriginSSLProtocols": [
"TLSv1.2"
]
},
"DomainName": {
"Fn::Select": [
2,
{
"Fn::Split": [
"/",
{
"Fn::GetAtt": [
"MyFunctionFunctionUrlFF6DE78C",
"FunctionUrl"
]
}
]
}
]
},
"Id": "integcloudfrontfunctionurlorigincustomoacDistributionOrigin187E79A3C",
"OriginAccessControlId": {
"Fn::GetAtt": [
"CustomOACCBB5FFDD",
"Id"
]
}
}
]
}
}
}
},
"Outputs": {
"ExportsOutputFnGetAttMyFunctionFunctionUrlFF6DE78CFunctionUrl4035958E": {
"Value": {
"Fn::GetAtt": [
"MyFunctionFunctionUrlFF6DE78C",
"FunctionUrl"
]
},
"Export": {
"Name": "integ-cloudfront-function-url-origin-custom-oac:ExportsOutputFnGetAttMyFunctionFunctionUrlFF6DE78CFunctionUrl4035958E"
}
},
"ExportsOutputRefDistribution830FAC524DF81588": {
"Value": {
"Ref": "Distribution830FAC52"
},
"Export": {
"Name": "integ-cloudfront-function-url-origin-custom-oac:ExportsOutputRefDistribution830FAC524DF81588"
}
},
"ExportsOutputFnGetAttDistribution830FAC52DomainNameBEB09E30": {
"Value": {
"Fn::GetAtt": [
"Distribution830FAC52",
"DomainName"
]
},
"Export": {
"Name": "integ-cloudfront-function-url-origin-custom-oac:ExportsOutputFnGetAttDistribution830FAC52DomainNameBEB09E30"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading