Why write your Pulumi programs yourself when you can have AI do it for you? Pulumi AI leverages large language models (LLMs) to author infrastructure as code for any architecture for any cloud in any language.
For the **GPT Your IaC Challenge**, your goal is to have Pulumi AI write a Pulumi program for any architecture you want and run a successful `pulumi up` with the program created. To participate in the challenge, you'll need to either visit [pulumi.com/ai](/ai) or download the [CLI](https://github.com/pulumi/pulumi-ai) so you can use Pulumi AI.
We will send you limited edition swag for completion of the challenge. We will also send you an even better piece of swag if you document this via a blog post, social media, or video. Tag us on social media or email us at [da@pulumi.com](mailto:da@pulumi.com), and we will help spread the word about your experience. All submissions will be judged at the end of the challenge, and the best submissions (there will be a few categories) will receive a special prize.
The challenge utilizes whatever cloud and whatever language you choose to ask Pulumi AI to write for you. Pulumi AI will do all the heavy lifting! However, in order to complete this challenge, you will need a couple things set up in advance.
- A [Pulumi account](https://app.pulumi.com/signup)
There are two ways to complete this challenge: using the Pulumi AI website or the CLI. For this example of doing the challenge, we used the Pulumi AI website to generate a Pulumi program, and then used the Pulumi CLI to run the generated program. If you plan to use the CLI, though, you will need to export your cloud provider (we'll use AWS in this example) and OpenAI credentials. To access your OpenAI credentials, go to [__API Keys__ tab](https://platform.openai.com/account/api-keys) in the OpenAI platform console. Then click `Create new secret key` .
Next, you will use Pulumi AI to generate a program that will provision cloud infrastructure. In this example, we asked Pulumi AI to create some database infrastructure that will be used for a real-time application that generates lots of data. Using the chat widget on the Pulumi AI page, describe the infrastructure you would like to build. In our case, we supplied: `Deploy a Kinesis Data Stream, RDS database, DynamoDB database, and Timestream database.`
Now that you have a generated Pulumi program, you will create a new Pulumi program to run the program. Create a new directory and a new Pulumi python project.
```shell
mkdir ai-challenge && cd ai-challenge
pulumi new aws-python
```
Copy the Pulumi AI generated program into `__main__.py`. Save the program and then run `pulumi up`. If your `pulumi up` operation succeeds, then you're done! (Maybe try it again with something more complex?) In our case, there was an error:
```shell
Diagnostics:
pulumi:pulumi:Stack (ai-challenge-dev):
error: Program failed with an unhandled exception:
Traceback (most recent call last):
File "/home/kao/code/test-folder/ai-challenge/./__main__.py", line 47, in <module>
Your Pulumi AI-generated program may not work when you run `pulumi up` the first time (like ours), but you can ask it to fix the error. It's OK to have Pulumi AI fix an error as part of the **GPT Your IaC Challenge**. Go back to [pulumi.com/ai](/ai) and enter in the chat widget `Fix this error <error output from pulumi up>`

Pulumi AI will fix the error. In this case it said
```
I see that the error is caused because the required property
database_name is missing in the timestreamwrite.Database resource.
Let me update the program to include the missing property.
```
Pulumi AI will return back the original program with the error corrected, which in our example now includes the previously-missing `database_name` parameter.
There you go! Pulumi AI has helped us generate a program to provision important database infrastructure for our new app. What did Pulumi AI generate for you?
Congratulations! You've completed this **Pulumi Challenge**. Follow the link below and complete your submission to receive limited edition swag for this challenge. You will need to upload a screenshot of the `pulumi up` output for us to verify completion.
{{<challenge/open-form-button>}}
If you want, please create a blog post, social media, or video documenting your work on this challenge. Tag us on social media or email us at [da@pulumi.com](mailto:da@pulumi.com) to claim another piece of even more special swag. Winners will be chosen in a few months and receive a special prize.
In this challenge, you have learned how to use Pulumi AI to generate a Pulumi program. The example we shared provisions a Kinesis Data Stream, RDS database, Timestream database, and a DynamoDB table.
If you'd like to tear down all of these resources and delete your stack, run `pulumi destroy -rf --remove`. Otherwise, have fun playing around with your infrastructure stack and add whatever you like! 🙂