https://pulumi.com logo
#aws
Title
# aws
d

delightful-controller-41497

08/06/2020, 10:47 AM
Hi there! Newbie here. I have question, if anyone is able to help. I've managed to create a Fargate service + RDS Postgres. The database is obviously empty, so I'd like to run
create database X;
as part of my Pulumi flow. How might one go about doing that?
b

broad-dog-22463

08/06/2020, 11:05 AM
You can potentially use the pulumi-postgreql provider if the machine running your Pulumi has access to the RDS instance
d

delightful-controller-41497

08/06/2020, 12:54 PM
Looking at the docs, trying to figure out how that would work. Might you have an example using pulumi-postgres?
b

broad-dog-22463

08/06/2020, 1:01 PM
No but I know that @better-actor-92669 uses that provider
he may be able to help
b

better-actor-92669

08/06/2020, 1:28 PM
Hey. Yeah, I do use pulumi-postgresql, but with pulumi-gcp. I can send you some code samples, pm me for any questions
d

delightful-controller-41497

08/06/2020, 1:33 PM
@better-actor-92669 I don't seem to be able to pm you... weird. would love to see some samples. In the meantime, I'm almost pulling it off with a Fargate Run Once Task. I'll make my main Fargate Service depend on it and wait for SUCCESS. But I'm not being able to figure out how to get this TaskDefinition into a Container that I can dependOn
b

better-actor-92669

08/06/2020, 1:49 PM
I am not anywhere near my PC arm, I will send you samples regarding pulumi-postgresql either today or tomorrow, but I have never touched Fargate
👍 1
h

hundreds-musician-51496

08/06/2020, 3:42 PM
An alternative approach would be to write a script that use spulumi to create the resources, and then initializes the database once created. I do something similar with a bash script for bringing up CI environments.
d

delightful-controller-41497

08/06/2020, 3:44 PM
@hundreds-musician-51496 is there some code you might be able to share? i guess that would require the database to the exposed to the world right?
probably the same problem I'm hitting with the pulumi postgres provider. it can't connect to the database because it is behind a vpc
h

hundreds-musician-51496

08/06/2020, 4:03 PM
I run the script via CodeBuild so I've set up permissions that allow the codebuild container to talk to the VPC
👍 1
Unforutnately I don't have any code that I could share