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(README.md): add python and java minimal deployment #582

Merged
merged 36 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7e002ef
added python min deployment and removed initializers
mickychetta Jan 19, 2022
ed641d6
pulled from main
mickychetta Jan 19, 2022
4ca5cd1
fixed merge conflict
mickychetta Jan 19, 2022
aaeadc7
changed to v1 imports in deprecated constructs
mickychetta Jan 19, 2022
886faff
added python min dep in new constructs
mickychetta Jan 19, 2022
f62ade7
added java minimal deployment code
mickychetta Feb 25, 2022
f987485
Merge branch 'main' of https://github.com/mickychetta/aws-solutions-c…
mickychetta Feb 25, 2022
279d872
fixed java builder prop defintion
mickychetta Feb 25, 2022
36aad3f
fixed indentation
mickychetta Feb 25, 2022
d2a7961
Merge branch 'main' into 552
mickychetta Feb 28, 2022
5cc1615
fixed indentation
mickychetta Feb 28, 2022
94bedd0
Merge branch 'main' of https://github.com/mickychetta/aws-solutions-c…
mickychetta Feb 28, 2022
c575709
fixed imports
mickychetta Mar 2, 2022
47726c4
Merge branch 'main' into 552
mickychetta Mar 2, 2022
593f5f8
updated python minimal deployments
mickychetta Mar 3, 2022
8900c41
merged main
mickychetta Mar 3, 2022
bcc7c32
Merge branch 'main' into 552
mickychetta Mar 3, 2022
033db99
updated java minimal deployments
mickychetta Mar 4, 2022
8af7579
Merge branch '552' of https://github.com/mickychetta/aws-solutions-co…
mickychetta Mar 4, 2022
e7ebda6
updated to correct prop in route53-apigateway
mickychetta Mar 7, 2022
e664c83
updated python minimal deployments
mickychetta Mar 14, 2022
4e23feb
cast to type Any in python example
mickychetta Mar 14, 2022
a7872b8
updated java minimal deployments
mickychetta Mar 17, 2022
722f2b4
Merge branch 'main' into 552
mickychetta Mar 17, 2022
668b655
updated java minimal deployments
mickychetta Mar 17, 2022
0b6f68a
Merge branch '552' of https://github.com/mickychetta/aws-solutions-co…
mickychetta Mar 17, 2022
aa3235e
updated typescript minimal deployments
mickychetta Mar 22, 2022
8b29c06
added viperlight ignore to README with fake account numbers
mickychetta Mar 22, 2022
eae978f
added viperlight ignore to README with fake account numbers
mickychetta Mar 22, 2022
747fee9
added v1 deprecated comments in v1 constructs
mickychetta Mar 29, 2022
c2b9177
Merge branch 'main' into 552
mickychetta Mar 29, 2022
b13e0f3
Merge branch 'main' into 552
mickychetta Mar 29, 2022
e3e738f
Merge branch 'main' of https://github.com/mickychetta/aws-solutions-c…
mickychetta Mar 29, 2022
24e6778
Merge branch 'main' into 552
mickychetta Mar 31, 2022
3a7bff7
changed asset name in aws-lambda-sqs-lambda
mickychetta Mar 31, 2022
3087604
Merge branch '552' of https://github.com/mickychetta/aws-solutions-co…
mickychetta Mar 31, 2022
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
14 changes: 14 additions & 0 deletions .viperlightignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md:35
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/alb-lambda.test.ts:27
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/alb-lambda.test.ts:680
# These are references to the us-east-1 ELBV2 account (publicly known)
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApi.expected.json:196
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApiExistingZone.expected.json:853
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPublicApiNewAlb.expected.json:191
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiNewResources.expected.json:199
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiNewResources.expected.json:202
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.twoTargets.expected.json:202
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiExistingResources.expected.json:1067
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiExistingResources.expected.json:1067
source/patterns/@aws-solutions-constructs/aws-alb-fargate/test/integ.all-new-two-targets.expected.json:1034
source/patterns/@aws-solutions-constructs/aws-alb-fargate/test/integ.all-new-public-http.expected.json:1007
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApi.expected.json:242
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApiExistingZone.expected.json:899
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPublicApiNewAlb.expected.json:237
Expand All @@ -155,3 +165,7 @@ source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiEx
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiExistingResources.expected.json:1113
source/patterns/@aws-solutions-constructs/aws-alb-fargate/test/integ.all-new-two-targets.expected.json:1081
source/patterns/@aws-solutions-constructs/aws-alb-fargate/test/integ.all-new-public-http.expected.json:1054
source/patterns/@aws-solutions-constructs/aws-alb-fargate/README.md:78
source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md:84
source/patterns/@aws-solutions-constructs/aws-route53-alb/README.md:59
source/patterns/@aws-solutions-constructs/aws-wafwebacl-alb/README.md:68
103 changes: 81 additions & 22 deletions source/patterns/@aws-solutions-constructs/aws-alb-fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,100 @@

This AWS Solutions Construct implements an an Application Load Balancer to an AWS Fargate service

Here is a minimal deployable pattern definition in Typescript:
Here is a minimal deployable pattern definition:

Typescript
``` typescript
import { AlbToFargate, AlbToFargateProps } from '@aws-solutions-constructs/aws-alb-fargate';

// Obtain a pre-existing certificate from your account
const certificate = acm.Certificate.fromCertificateArn(
scope,
'existing-cert',
"arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
);

const props: AlbToFargateProps = {
import { Construct } from 'constructs';
import { Stack, StackProps } from 'aws-cdk-lib';
import { AlbToFargate, AlbToFargateProps } from '@aws-solutions-constructs/aws-alb-fargate';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';

const certificate = acm.Certificate.fromCertificateArn(
this,
'existing-cert',
"arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
);

const constructProps: AlbToFargateProps = {
ecrRepositoryArn: "arn:aws:ecr:us-east-1:123456789012:repository/your-ecr-repo",
ecrImageVersion: "latest",
listenerProps: {
certificates: [ certificate ]
certificates: [certificate]
},
publicApi: true
};
};

new AlbToFargate(stack, 'new-construct', props);
// Note - all alb constructs turn on ELB logging by default, so require that an environment including account
// and region be provided when creating the stack
//
// new MyStack(app, 'id', {env: {account: '123456789012', region: 'us-east-1' }});
new AlbToFargate(this, 'new-construct', constructProps);
```

## Initializer
Python
``` python
from aws_solutions_constructs.aws_alb_fargate import AlbToFargate, AlbToFargateProps
from aws_cdk import (
aws_certificatemanager as acm,
aws_elasticloadbalancingv2 as alb,
Stack
)
from constructs import Construct

# Obtain a pre-existing certificate from your account
certificate = acm.Certificate.from_certificate_arn(
self,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indent doesn't match the indent in the next function call (line 68). I know that indentions are important in Python ([sarcasm]one of the things I love so much about it[/sarcasm]), we should be consistent.

'existing-cert',
"arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
)

# Note - all alb constructs turn on ELB logging by default, so require that an environment including account
# and region be provided when creating the stack
#
# MyStack(app, 'id', env=cdk.Environment(account='679431688440', region='us-east-1'))
AlbToFargate(self, 'new-construct',
ecr_repository_arn="arn:aws:ecr:us-east-1:123456789012:repository/your-ecr-repo",
ecr_image_version="latest",
listener_props=alb.BaseApplicationListenerProps(
certificates=[certificate],
),
public_api=True)

``` text
new AlbToFargate(scope: Construct, id: string, props: AlbToFargateProps);
```

_Parameters_

* scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html)
* id `string`
* props [`AlbToFargateProps`](#pattern-construct-props)
Java
mickychetta marked this conversation as resolved.
Show resolved Hide resolved
``` java
import software.constructs.Construct;
import java.util.List;

import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.elasticloadbalancingv2.*;
import software.amazon.awsconstructs.services.albfargate.*;

// The code that defines your stack goes here
// Obtain a pre-existing certificate from your account
ListenerCertificate listenerCertificate = ListenerCertificate
.fromArn("arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012");

// Note - all alb constructs turn on ELB logging by default, so require that an environment including account
// and region be provided when creating the stack
//
// new MyStack(app, "id", StackProps.builder()
// .env(Environment.builder()
// .account("123456789012")
// .region("us-east-1")
// .build());
new AlbToFargate(this, "AlbToFargatePattern", new AlbToFargateProps.Builder()
.ecrRepositoryArn("arn:aws:ecr:us-east-1:123456789012:repository/your-ecr-repo")
.ecrImageVersion("latest")
.listenerProps(new BaseApplicationListenerProps.Builder()
.certificates(List.of(listenerCertificate))
.build())
.publicApi(true)
.build());
```

## Pattern Construct Props

Expand Down
130 changes: 100 additions & 30 deletions source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,112 @@

This AWS Solutions Construct implements an an Application Load Balancer to an AWS Lambda function

Here is a minimal deployable pattern definition in Typescript:
Here is a minimal deployable pattern definition:

Typescript
``` typescript

// Obtain a pre-existing certificate from your account
const certificate = acm.Certificate.fromCertificateArn(
scope,
'existing-cert',
"arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
);
const props: AlbToLambdaProps = {
lambdaFunctionProps: {
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler'
},
listenerProps: {
certificates: [ certificate ]
},
publicApi: true
};
new AlbToLambda(stack, 'new-construct', props);

import { Construct } from 'constructs';
import { Stack, StackProps } from 'aws-cdk-lib';
import { AlbToLambda, AlbToLambdaProps } from '@aws-solutions-constructs/aws-alb-lambda';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as lambda from 'aws-cdk-lib/aws-lambda';

// Obtain a pre-existing certificate from your account
const certificate = acm.Certificate.fromCertificateArn(
this,
'existing-cert',
"arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
);

const constructProps: AlbToLambdaProps = {
lambdaFunctionProps: {
code: lambda.Code.fromAsset(`lambda`),
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler'
},
listenerProps: {
certificates: [certificate]
},
publicApi: true
};

// Note - all alb constructs turn on ELB logging by default, so require that an environment including account
// and region be provided when creating the stack
//
// new MyStack(app, 'id', {env: {account: '123456789012', region: 'us-east-1' }});
new AlbToLambda(this, 'new-construct', constructProps);
```

## Initializer

``` text
new AlbToLambda(scope: Construct, id: string, props: AlbToLambdaProps);
Python
``` python
from aws_solutions_constructs.aws_alb_lambda import AlbToLambda, AlbToLambdaProps
from aws_cdk import (
aws_certificatemanager as acm,
aws_lambda as _lambda,
aws_elasticloadbalancingv2 as alb,
Stack
)
from constructs import Construct

# Obtain a pre-existing certificate from your account
certificate = acm.Certificate.from_certificate_arn(
self,
'existing-cert',
"arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
)

# Note - all alb constructs turn on ELB logging by default, so require that an environment including account
# and region be provided when creating the stack
#
# MyStack(app, 'id', env=cdk.Environment(account='679431688440', region='us-east-1'))
AlbToLambda(self, 'new-construct',
lambda_function_props=_lambda.FunctionProps(
runtime=_lambda.Runtime.PYTHON_3_7,
code=_lambda.Code.from_asset('lambda'),
handler='index.handler',
),
listener_props=alb.BaseApplicationListenerProps(
certificates=[certificate]
),
public_api=True)
```

_Parameters_

* scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html)
* id `string`
* props [`AlbToLambdaProps`](#pattern-construct-props)
Java
``` java
import software.constructs.Construct;
import java.util.List;

import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.elasticloadbalancingv2.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.lambda.Runtime;
import software.amazon.awsconstructs.services.alblambda.*;

// Obtain a pre-existing certificate from your account
ListenerCertificate listenerCertificate = ListenerCertificate
.fromArn("arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012");

// Note - all alb constructs turn on ELB logging by default, so require that an environment including account
// and region be provided when creating the stack
//
// new MyStack(app, "id", StackProps.builder()
// .env(Environment.builder()
// .account("123456789012")
// .region("us-east-1")
// .build());
new AlbToLambda(this, "AlbToLambdaPattern", new AlbToLambdaProps.Builder()
.lambdaFunctionProps(new FunctionProps.Builder()
.runtime(Runtime.NODEJS_14_X)
.code(Code.fromAsset("lambda"))
.handler("index.handler")
.build())
.listenerProps(new BaseApplicationListenerProps.Builder()
.certificates(List.of(listenerCertificate))
.build())
.publicApi(true)
.build());
```

## Pattern Construct Props

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,37 @@
## Overview
This AWS Solutions Construct implements an Amazon API Gateway REST API connected to Amazon DynamoDB table.

Here is a minimal deployable pattern definition in Typescript:
Here is a minimal deployable pattern definition in

Typescript:
``` typescript
import { Construct } from 'constructs';
import { Stack, StackProps } from 'aws-cdk-lib';
import { ApiGatewayToDynamoDBProps, ApiGatewayToDynamoDB } from "@aws-solutions-constructs/aws-apigateway-dynamodb";

new ApiGatewayToDynamoDB(this, 'test-api-gateway-dynamodb-default', {});

```

## Initializer
Python
``` python
from aws_solutions_constructs.aws_apigateway_dynamodb import ApiGatewayToDynamoDB
from aws_cdk import Stack
from constructs import Construct

``` text
new ApiGatewayToDynamoDB(scope: Construct, id: string, props: ApiGatewayToDynamoDBProps);
ApiGatewayToDynamoDB(self, 'test-api-gateway-dynamodb-default')
```

_Parameters_
Java
``` java
import software.constructs.Construct;

import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awsconstructs.services.apigatewaydynamodb.*;

* scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html)
* id `string`
* props [`ApiGatewayToDynamoDBProps`](#pattern-construct-props)
new ApiGatewayToDynamoDB(this, "test-api-gateway-dynamodb-default", new ApiGatewayToDynamoDBProps.Builder()
.build());
```

## Pattern Construct Props

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,41 @@ This construct creates a scalable HTTPS proxy between API Gateway and AWS IoT. T

This implementation enables write-only messages to be published on given MQTT topics, and also supports shadow updates of HTTPS devices to allowed things in the device registry. It does not involve Lambda functions for proxying messages, and instead relies on direct API Gateway to AWS IoT integration which supports both JSON messages as well as binary messages.

Here is a minimal deployable pattern definition in Typescript:
Here is a minimal deployable pattern definition:

Typescript
``` typescript
import { Construct } from 'constructs';
import { Stack, StackProps } from 'aws-cdk-lib';
import { ApiGatewayToIot } from '@aws-solutions-constructs/aws-apigateway-iot';

new ApiGatewayToIot(this, 'ApiGatewayToIotPattern', {
iotEndpoint: 'a1234567890123-ats'
});

```

## Initializer
Python
``` python
from aws_solutions_constructs.aws_apigateway_iot import ApiGatewayToIot
from aws_cdk import Stack
from constructs import Construct

``` text
new ApiGatewayToIot(scope: Construct, id: string, props: ApiGatewayToIotProps);
ApiGatewayToIot(self, 'ApiGatewayToIotPattern',
iot_endpoint='a1234567890123-ats'
)
```
Java
``` java
import software.constructs.Construct;

_Parameters_

* scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html)
* id `string`
* props [`ApiGatewayToIotProps`](#pattern-construct-props)
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awsconstructs.services.apigatewayiot.*;

new ApiGatewayToIot(this, "ApiGatewayToIotPattern", new ApiGatewayToIotProps.Builder()
.iotEndpoint("a1234567890123-ats")
.build());
```
## Pattern Construct Props

| **Name** | **Type** | **Description** |
Expand Down
Loading