https://pulumi.com logo
#python
Title
# python
s

shy-football-10348

09/30/2020, 2:59 AM
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

faint-table-42725

09/30/2020, 5:09 PM
What are your package versions? I see this class in the SDK
s

shy-football-10348

10/01/2020, 6:57 PM
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

faint-table-42725

10/05/2020, 4:58 PM
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

shy-football-10348

10/05/2020, 7:44 PM
appreciate you diving deep w/ me on that. helps a lot.