Does anyone have an example of enabling ALB access...
# python
s
Does anyone have an example of enabling ALB access logs? I have the following code which doesn’t work:
Copy code
alb_http_bucket_key = aws.kms.Key(
    "jupyterhub-alb-http-bucket-key",
    deletion_window_in_days=10,
    description="This key is used to encrypt bucket objects",
)

alb_http_bucket = aws.s3.Bucket(
    "jupyterhub-alb-http-logs",
    server_side_encryption_configuration={
        "rule": {
            "applyServerSideEncryptionByDefault": {
                "kms_master_key_id": alb_http_bucket_key.arn,
                "sseAlgorithm": "aws:kms",
            },
        },
    },
)

alb = aws.lb.LoadBalancer(
    "jupyterhub-alb",
    security_groups=[sgroup.id], 
    subnets=jupyterhub_priv_subnets,
    internal=True,
    access_logs=aws.lb.LoadBalancerAccessLogsArgs(
        bucket=alb_http_bucket.bucket_domain_name,
        enabled=True
    )
)
The bit I cannot get right is the
access_logs=
field. I directly referenced another function that has an example using the same data type that
access_logs
requires and I still cant get it to work 😞
Copy code
AttributeError: module '<http://pulumi_aws.lb|pulumi_aws.lb>' has no attribute 'LoadBalancerAccessLogsArgs'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
huh, could have sworn there was no example when i check this last: https://www.pulumi.com/docs/reference/pkg/aws/alb/loadbalancer/#loadbalanceraccesslogs
regardless, i get the same error, the code i have is the same anyway :(
f
What are your package versions? I see this class in the SDK
s
hey thank you for your reply! i dont see this class in my IDE im on
pulumi_aws
3.5.0 Successfully installed pulumi-2.11.1 pulumi-aws-3.5.0
i see it now
trying again
it worked, thank you for the help. cant believe i was using an out of date version to the point this wasn’t even included.
f
This is because of the recent changes in Python tooling to add data classes (https://www.pulumi.com/blog/announcing-python-tooling-improvements/). Before, you’d pass in a dict (and you still can), but our examples show the more type-safe approach.
s
appreciate you diving deep w/ me on that. helps a lot.