LambdaAccess Class
Access configuration options for Lambda functions like setup and webhook function. Use this to limit access to these functions.
If you need a custom access point, you can implement this abstract class yourself. Note that the Lambda functions expect API Gateway v1 or v2 input. They also expect every URL under the constructed URL to point to the function.
Initializer
import { LambdaAccess } from '@cloudsnorkel/cdk-github-runners'
new LambdaAccess()import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.LambdaAccess()import com.cloudsnorkel.cdk.github.runners.LambdaAccess;
new LambdaAccess();using CloudSnorkel;
new LambdaAccess();import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.NewLambdaAccess() LambdaAccessMethods
bind()bind()bind()Bind()Bind()
Creates all required resources and returns access URL or empty string if disabled.
public bind(scope: Construct, id: string, lambdaFunction: Function): stringdef bind(
scope: Construct,
id: str,
lambda_function: Function
) -> strpublic java.lang.String bind(Construct scope, java.lang.String id, Function lambdaFunction)private string Bind(Construct Scope, string Id, Function LambdaFunction)func Bind(scope Construct, id *string, lambdaFunction Function) *stringStatic Functions
apiGateway()api_gateway()apiGateway()ApiGateway()ApiGateway()
Provide access using API Gateway.
This is the most secure option, but requires additional configuration. It allows you to limit access to specific IP addresses and even to a specific VPC.
To limit access to GitHub.com use:
LambdaAccess.apiGateway({
allowedIps: LambdaAccess.githubWebhookIps(),
});Alternatively, get and manually update the list manually with:
curl https://api.github.com/meta | jq .hooksimport { LambdaAccess } from '@cloudsnorkel/cdk-github-runners'
LambdaAccess.apiGateway(props?: ApiGatewayAccessProps)props?:ApiGatewayAccessProps
import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.LambdaAccess.api_gateway(
access_log_group: ILogGroup = None,
allowed_ips: typing.List[str] = None,
allowed_security_groups: typing.List[ISecurityGroup] = None,
allowed_vpc: IVpc = None,
allowed_vpc_endpoints: typing.List[IVpcEndpoint] = None,
logging_level: MethodLoggingLevel = None
)access_log_group?:ILogGroupLog group for access logs, with one JSON line for each request.
API Gateway can only write logs once the account has a CloudWatch Logs role. See https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html
Default: no access logs
allowed_ips?:typing.List[str]List of IP addresses in CIDR notation that are allowed to access the API Gateway.
If not specified on public API Gateway, all IP addresses are allowed.
If not specified on private API Gateway, no IP addresses are allowed (but specified security groups are).
allowed_security_groups?:typing.List[ISecurityGroup]List of security groups that are allowed to access the API Gateway.
Only works for private API Gateways with
ApiGatewayAccessProps.allowedVpc.allowed_vpc?:IVpcCreate a private API Gateway and allow access from the specified VPC.
allowed_vpc_endpoints?:typing.List[IVpcEndpoint]Create a private API Gateway and allow access from the specified VPC endpoints.
Use this to make use of existing VPC endpoints or to share an endpoint between multiple functions. The VPC endpoint must point to
ec2.InterfaceVpcEndpointAwsService.APIGATEWAY.No other settings are supported when using this option.
All endpoints will be allowed access, but only the first one will be used as the URL by the runner system for setting up the webhook, and as setup URL.
logging_level?:MethodLoggingLevelLevel of execution logs. API Gateway writes them to its own log group named
API-Gateway-Execution-Logs_{rest-api-id}/{stage}.Like access logs, these need a CloudWatch Logs role in the account.
Default: no execution logs
import com.cloudsnorkel.cdk.github.runners.LambdaAccess;
LambdaAccess.apiGateway(),LambdaAccess.apiGateway(ApiGatewayAccessProps props)props?:ApiGatewayAccessProps
using CloudSnorkel;
LambdaAccess.ApiGateway(ApiGatewayAccessProps Props = null);Props?:ApiGatewayAccessProps
import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.LambdaAccess_ApiGateway(props ApiGatewayAccessProps) LambdaAccessprops?:ApiGatewayAccessProps
githubWebhookIps()github_webhook_ips()githubWebhookIps()GithubWebhookIps()GithubWebhookIps()
Downloads the list of IP addresses used by GitHub.com for webhooks.
Note that downloading dynamic data during deployment is not recommended in CDK. This is a workaround for the lack of a better solution.
import { LambdaAccess } from '@cloudsnorkel/cdk-github-runners'
LambdaAccess.githubWebhookIps()import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.LambdaAccess.github_webhook_ips()import com.cloudsnorkel.cdk.github.runners.LambdaAccess;
LambdaAccess.githubWebhookIps()using CloudSnorkel;
LambdaAccess.GithubWebhookIps();import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.LambdaAccess_GithubWebhookIps() *[]*stringlambdaUrl()lambda_url()lambdaUrl()LambdaUrl()LambdaUrl()
Provide access using Lambda URL.
This is the default and simplest option. It puts no limits on the requester, but the Lambda functions themselves authenticate every request.
import { LambdaAccess } from '@cloudsnorkel/cdk-github-runners'
LambdaAccess.lambdaUrl()import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.LambdaAccess.lambda_url()import com.cloudsnorkel.cdk.github.runners.LambdaAccess;
LambdaAccess.lambdaUrl()using CloudSnorkel;
LambdaAccess.LambdaUrl();import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.LambdaAccess_LambdaUrl() LambdaAccessnoAccess()no_access()noAccess()NoAccess()NoAccess()
Disables access to the configured Lambda function.
This is useful for the setup function after setup is done.
import { LambdaAccess } from '@cloudsnorkel/cdk-github-runners'
LambdaAccess.noAccess()import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.LambdaAccess.no_access()import com.cloudsnorkel.cdk.github.runners.LambdaAccess;
LambdaAccess.noAccess()using CloudSnorkel;
LambdaAccess.NoAccess();import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.LambdaAccess_NoAccess() LambdaAccess