aws-cdk.aws-elasticloadbalancingv2-actions


Nameaws-cdk.aws-elasticloadbalancingv2-actions JSON
Version 1.203.0 PyPI version JSON
download
home_pagehttps://github.com/aws/aws-cdk
SummaryIntegration actions for AWS ElasticLoadBalancingV2
upload_time2023-05-31 23:02:23
maintainer
docs_urlNone
authorAmazon Web Services
requires_python~=3.7
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Actions for AWS Elastic Load Balancing V2

<!--BEGIN STABILITY BANNER-->---


![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)

---
<!--END STABILITY BANNER-->

This package contains integration actions for ELBv2. See the README of the `@aws-cdk/aws-elasticloadbalancingv2` library.

## Cognito

ELB allows for requests to be authenticated against a Cognito user pool using
the `AuthenticateCognitoAction`. For details on the setup's requirements,
read [Prepare to use Amazon
Cognito](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html#cognito-requirements).
Here's an example:

```python
import aws_cdk.aws_cognito as cognito
import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_elasticloadbalancingv2 as elbv2
from aws_cdk.core import App, CfnOutput, Stack
from constructs import Construct
import aws_cdk.aws_elasticloadbalancingv2_actions as actions

Stack): lb = elbv2.ApplicationLoadBalancer(self, "LB",
    vpc=vpc,
    internet_facing=True
)

user_pool = cognito.UserPool(self, "UserPool")
user_pool_client = cognito.UserPoolClient(self, "Client",
    user_pool=user_pool,

    # Required minimal configuration for use with an ELB
    generate_secret=True,
    auth_flows=cognito.AuthFlow(
        user_password=True
    ),
    o_auth=cognito.OAuthSettings(
        flows=cognito.OAuthFlows(
            authorization_code_grant=True
        ),
        scopes=[cognito.OAuthScope.EMAIL],
        callback_urls=[f"https://{lb.loadBalancerDnsName}/oauth2/idpresponse"
        ]
    )
)
cfn_client = user_pool_client.node.default_child
cfn_client.add_property_override("RefreshTokenValidity", 1)
cfn_client.add_property_override("SupportedIdentityProviders", ["COGNITO"])

user_pool_domain = cognito.UserPoolDomain(self, "Domain",
    user_pool=user_pool,
    cognito_domain=cognito.CognitoDomainOptions(
        domain_prefix="test-cdk-prefix"
    )
)

lb.add_listener("Listener",
    port=443,
    certificates=[certificate],
    default_action=actions.AuthenticateCognitoAction(
        user_pool=user_pool,
        user_pool_client=user_pool_client,
        user_pool_domain=user_pool_domain,
        next=elbv2.ListenerAction.fixed_response(200,
            content_type="text/plain",
            message_body="Authenticated"
        )
    )
)

CfnOutput(self, "DNS",
    value=lb.load_balancer_dns_name
)

app = App()
CognitoStack(app, "integ-cognito")
app.synth()
```

> NOTE: this example seems incomplete, I was not able to get the redirect back to the
> Load Balancer after authentication working. Would love some pointers on what a full working
> setup actually looks like!



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aws/aws-cdk",
    "name": "aws-cdk.aws-elasticloadbalancingv2-actions",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Amazon Web Services",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/45/76/1cf560e744be9231f424e1e9010cbbbc7ff7b43996cdda3fc0fd9caf7442/aws-cdk.aws-elasticloadbalancingv2-actions-1.203.0.tar.gz",
    "platform": null,
    "description": "# Actions for AWS Elastic Load Balancing V2\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)\n\n---\n<!--END STABILITY BANNER-->\n\nThis package contains integration actions for ELBv2. See the README of the `@aws-cdk/aws-elasticloadbalancingv2` library.\n\n## Cognito\n\nELB allows for requests to be authenticated against a Cognito user pool using\nthe `AuthenticateCognitoAction`. For details on the setup's requirements,\nread [Prepare to use Amazon\nCognito](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html#cognito-requirements).\nHere's an example:\n\n```python\nimport aws_cdk.aws_cognito as cognito\nimport aws_cdk.aws_ec2 as ec2\nimport aws_cdk.aws_elasticloadbalancingv2 as elbv2\nfrom aws_cdk.core import App, CfnOutput, Stack\nfrom constructs import Construct\nimport aws_cdk.aws_elasticloadbalancingv2_actions as actions\n\nStack): lb = elbv2.ApplicationLoadBalancer(self, \"LB\",\n    vpc=vpc,\n    internet_facing=True\n)\n\nuser_pool = cognito.UserPool(self, \"UserPool\")\nuser_pool_client = cognito.UserPoolClient(self, \"Client\",\n    user_pool=user_pool,\n\n    # Required minimal configuration for use with an ELB\n    generate_secret=True,\n    auth_flows=cognito.AuthFlow(\n        user_password=True\n    ),\n    o_auth=cognito.OAuthSettings(\n        flows=cognito.OAuthFlows(\n            authorization_code_grant=True\n        ),\n        scopes=[cognito.OAuthScope.EMAIL],\n        callback_urls=[f\"https://{lb.loadBalancerDnsName}/oauth2/idpresponse\"\n        ]\n    )\n)\ncfn_client = user_pool_client.node.default_child\ncfn_client.add_property_override(\"RefreshTokenValidity\", 1)\ncfn_client.add_property_override(\"SupportedIdentityProviders\", [\"COGNITO\"])\n\nuser_pool_domain = cognito.UserPoolDomain(self, \"Domain\",\n    user_pool=user_pool,\n    cognito_domain=cognito.CognitoDomainOptions(\n        domain_prefix=\"test-cdk-prefix\"\n    )\n)\n\nlb.add_listener(\"Listener\",\n    port=443,\n    certificates=[certificate],\n    default_action=actions.AuthenticateCognitoAction(\n        user_pool=user_pool,\n        user_pool_client=user_pool_client,\n        user_pool_domain=user_pool_domain,\n        next=elbv2.ListenerAction.fixed_response(200,\n            content_type=\"text/plain\",\n            message_body=\"Authenticated\"\n        )\n    )\n)\n\nCfnOutput(self, \"DNS\",\n    value=lb.load_balancer_dns_name\n)\n\napp = App()\nCognitoStack(app, \"integ-cognito\")\napp.synth()\n```\n\n> NOTE: this example seems incomplete, I was not able to get the redirect back to the\n> Load Balancer after authentication working. Would love some pointers on what a full working\n> setup actually looks like!\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Integration actions for AWS ElasticLoadBalancingV2",
    "version": "1.203.0",
    "project_urls": {
        "Homepage": "https://github.com/aws/aws-cdk",
        "Source": "https://github.com/aws/aws-cdk.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5b58277b380594f7a7471a6b8562de522eec35a87df3e6f0891928a33527b29",
                "md5": "1f77ee0ae4f22a4299bf42b237c5663c",
                "sha256": "f072e4d5f5854da02a84b7f75b775196625f428bd4bf7c66331d568af1d63d2c"
            },
            "downloads": -1,
            "filename": "aws_cdk.aws_elasticloadbalancingv2_actions-1.203.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f77ee0ae4f22a4299bf42b237c5663c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 30924,
            "upload_time": "2023-05-31T22:54:52",
            "upload_time_iso_8601": "2023-05-31T22:54:52.127374Z",
            "url": "https://files.pythonhosted.org/packages/d5/b5/8277b380594f7a7471a6b8562de522eec35a87df3e6f0891928a33527b29/aws_cdk.aws_elasticloadbalancingv2_actions-1.203.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45761cf560e744be9231f424e1e9010cbbbc7ff7b43996cdda3fc0fd9caf7442",
                "md5": "91cae4dcca5f2dff7d1d6f3ea540b5e6",
                "sha256": "d6e304daac2170870ed6d0499730775a7a66c98d21f76112359f7cb83bcc204e"
            },
            "downloads": -1,
            "filename": "aws-cdk.aws-elasticloadbalancingv2-actions-1.203.0.tar.gz",
            "has_sig": false,
            "md5_digest": "91cae4dcca5f2dff7d1d6f3ea540b5e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 31533,
            "upload_time": "2023-05-31T23:02:23",
            "upload_time_iso_8601": "2023-05-31T23:02:23.176254Z",
            "url": "https://files.pythonhosted.org/packages/45/76/1cf560e744be9231f424e1e9010cbbbc7ff7b43996cdda3fc0fd9caf7442/aws-cdk.aws-elasticloadbalancingv2-actions-1.203.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-31 23:02:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aws",
    "github_project": "aws-cdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aws-cdk.aws-elasticloadbalancingv2-actions"
}
        
Elapsed time: 0.14390s