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

great-spring-37193

08/01/2023, 7:49 PM
#python I am new to pulumi. Trying to combine pulumi and boto3 for my use case but getting below error
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter BucketArn, value: Calling __str__ on an Output[T] is not supported
Here is the code snippet:
Copy code
import pulumi
import pulumi_aws as aws
import boto3

# Create an AWS S3 Bucket using Pulumi
bucket = aws.s3.Bucket("my-bucket")

# Obtain the ARN of the S3 Bucket from the Pulumi resource
bucket_arn = bucket.arn

# Use Boto3 with the ARN
s3_client = boto3.client("s3")
response = s3_client.list_objects_v2(Bucket=bucket_arn)

# Process the response from Boto3 as needed
for obj in response.get("Contents", []):
    print(obj["Key"])
c

clever-kite-79772

08/01/2023, 8:04 PM
Copy code
bucket.arn.apply(lambda v:

  s3_client = boto3.client("s3")
  response =    s3_client.list_objects_v2(Bucket=v)

  for obj in response.get("Contents", []):
      print(obj["Key"])
)
Somehitng like this should be
g

great-spring-37193

08/02/2023, 7:37 PM
@clever-kite-79772 syntax error.
c

clever-kite-79772

08/02/2023, 7:49 PM
@great-spring-37193 I know about syntax error - it's just the general idea. If you'd like to use boto3 + pulumi, than you have to use all boto3 code within lamda.
g

great-spring-37193

08/03/2023, 1:04 PM
Thanks but want to take that response outside that lambda but pulumi providing only Output[T].
c

clever-kite-79772

08/03/2023, 1:53 PM
You can't get response outside lambda. Pulumi doesn't provide it.
5 Views