-
be sure to set .wsconfig for memory consuming issue
-
install
nvm -
install
Node.js -
install CDK CLI
-
install dotnet SDK(this takes a long time)
-
locally build a dotnet6 lambda container image (no official image atm)
-
create Lambda
docker build -f LambdaRuntimeDockerfiles/Images/net6/amd64/Dockerfile -t dotnet6-runtime:base-image-amd64 .- edit the Dockerfile as suggested by the README.md
FROM dotnet6-runtime:base-image-amd64 AS base FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim as build WORKDIR /src COPY ["ImportFunction.csproj", "ImportFunction/"] RUN dotnet restore "ImportFunction/ImportFunction.csproj" WORKDIR "/src/ImportFunction" COPY . . RUN dotnet build "ImportFunction.csproj" --configuration Release --output /app/build FROM build AS publish RUN dotnet publish "ImportFunction.csproj" \ --configuration Release \ --runtime linux-x64 \ --self-contained false \ --output /app/publish \ -p:PublishReadyToRun=true FROM base AS final WORKDIR /var/task COPY --from=publish /app/publish . CMD ["ImportFunction::ImportFunction.Function::FunctionHandler"]
-
where's the current directory when using ImageFromAsset?
- probably where cdk.json is
-
how to set the entrypoint for the docker image for lambda
- set the
CMDto the full qualified function path as suggested here
- set the
-
output of Lambda is inside
Payload
Last active
November 24, 2021 07:03
-
-
Save kenfdev/d801e8f999860aa4e1ea8f3a0b7b010a to your computer and use it in GitHub Desktop.
CDK
This file contains hidden or 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
| import * as ecr from '@aws-cdk/aws-ecr'; | |
| import { TagMutability } from '@aws-cdk/aws-ecr'; | |
| new ecr.CfnRepository(this, 'BackendRepository', { | |
| repositoryName: 'sbcntr-backend', | |
| imageTagMutability: TagMutability.MUTABLE, | |
| imageScanningConfiguration: { | |
| scanOnPush: false, | |
| }, | |
| encryptionConfiguration: { | |
| encryptionType: 'KMS', | |
| }, | |
| }); |
This file contains hidden or 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
| // any principal | |
| new iam.PolicyStatement({ | |
| actions: ['*'], | |
| effect: iam.Effect.ALLOW, | |
| resources: ['*'], | |
| principals: [new iam.AnyPrincipal()], | |
| }); |
This file contains hidden or 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
| // Interface VPC Endpoint | |
| const vpceEcrApi = new ec2.InterfaceVpcEndpoint(this, 'VpceEcrApi', { | |
| vpc: props.vpc, | |
| service: ec2.InterfaceVpcEndpointAwsService.ECR, | |
| privateDnsEnabled: true, | |
| subnets: { | |
| subnets: props.egressSubnets, | |
| }, | |
| securityGroups: [props.egressSecurityGroup], | |
| }); | |
| Tags.of(vpceEcrApi).add('Name', 'sbcntr-vpce-ecr-api'); | |
| vpceEcrApi.addToPolicy( | |
| new iam.PolicyStatement({ | |
| actions: ['*'], | |
| effect: iam.Effect.ALLOW, | |
| resources: ['*'], | |
| principals: [new iam.AnyPrincipal()], | |
| }) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
