51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
"""An AWS Python Pulumi program"""
|
|
|
|
import pulumi
|
|
from pulumi_aws import aws
|
|
from pulumi_aws import s3
|
|
import pulumi_aws_apigateway as apigateway
|
|
import json
|
|
role = aws.iam.Role("mylambda-role",
|
|
assume_role_policy=json.dumps({
|
|
"Version": "2012-10-17",
|
|
"Statement": [{
|
|
"Effect": "Allow",
|
|
"Principal": { "Service": "lambda.amazonaws.com" },
|
|
"Action": "sts:AssumeRole"
|
|
}]
|
|
})
|
|
)
|
|
# Create an AWS resource (S3 Bucket)
|
|
bucket = s3.Bucket('br-edu-ifsp-ifsp-ret-s3-bucket-chatbot-editais-d',
|
|
tags={
|
|
"nome":"bucket-chatbot-editais",
|
|
"ambiente":"dev",
|
|
"projeto":"chatbot-editais",
|
|
"responsavel":"dti.prd@ifsp.edu.br",
|
|
"criticidade":"baixa",
|
|
"data-de-criacao":"03-09-2025",
|
|
"backup":"nunca",
|
|
"servico":"sistemas",
|
|
"prospeccao":"sim",
|
|
"poc":"sim",
|
|
"ia":"sim",
|
|
"modelo":"claude-sonnet-4"
|
|
})
|
|
f = aws.lambda_.Function("mylambda",
|
|
runtime=aws.lambda_.Runtime.PYTHON3D8,
|
|
code=pulumi.AssetArchive({
|
|
".": pulumi.FileArchive("./handler"),
|
|
}),
|
|
timeout=300,
|
|
handler="handler.handler",
|
|
role=role.arn,
|
|
opts=pulumi.ResourceOptions(depends_on=[policy]),
|
|
)
|
|
|
|
api = apigateway.RestAPI('api', routes=[
|
|
apigateway.RouteArgs(path="/", method="GET", event_handler=f),
|
|
])
|
|
|
|
# Export the name of the bucket
|
|
pulumi.export('bucket_name', bucket.id)
|