Pulumi Architecture Templates make it quick and easy to get started with a wide variety of clouds, tools, and technologies when you want to try something new but don't want to write boilerplate yourself. It's a great way to get started with Pulumi quickly, no matter what you need to build. Try it for yourself with serverless AWS templates and win some swag in the process!
In this Challenge, you will learn how to create a new Pulumi program using [our new Pulumi Architecture Templates](/templates/), specifically for serverless blueprints for AWS with the language of your choice.
Pulumi can create a serverless app with AWS API Gateway and Lambda in many common programming languages. Today, we'll be working with Python. Create a new directory called `quickstart-challenge` and `cd` into it, then run the following:
```shell
pulumi new serverless-aws-python
```
Regardless of the language you choose, the Pulumi CLI will ask several questions of you. Name the project `one-quickstart` when prompted, and accept all other defaults. It will look something like this:
```shell
kat@Kats-MacBook-Pro testing-challenge % pulumi new serverless-aws-python
This command will walk you through creating a new Pulumi project.
Enter a value or leave blank to accept the (default), and press <ENTER>.
Press ^C at any time to quit.
project name: one-quickstart
project description: (A serverless app on AWS API Gateway and Lambda)
Created project 'one-quickstart'
Please enter your desired stack name.
To create a stack in an organization, use the format <org-name>/<stack-name> (e.g. `acmecorp/dev`).
stack name: (dev)
Created stack 'dev'
aws:region: The AWS region to deploy into: (us-west-2)
Select `yes` and watch your resources come online! With a single command, Pulumi is standing up an AWS API Gateway and Lambda instance, with all necessary roles and permissions, plus a `hello world` website displaying the current time. Cool, right?
When you're using Python or Typescript, Pulumi allows you to enforce gated deployments with [Policy Packs](/docs/using-pulumi/crossguard/configuration/), which can be used locally with the free tier. These are a set of rules, expressed programmatically, that are executed against the resources being deployed. Any violation of those rules will block the deployment. Usually, Policy Packs are used to enforce security or cost optimization rules, but in this case we're going to use one to interact with our swag provider.
Within your existing Pulumi program, create a new directory for your Policy Pack and navigate into it:
```shell
mkdir policy && cd policy
```
Creating your policy pack is simple:
```shell
pulumi policy new aws-python
```
Pulumi will once again create several files for you, including another `__main__.py`. The default Policy Pack prevents developers from allowing public read access on an AWS S3 bucket, but that isn't what we need here. Replace the contents of the new `__main__.py` with the following:
The Policy Pack we've defined requires that your Pulumi program involve a JSON file containing specific data. In order to comply with it and get swag, we need to create this file.
Navigate one directory up, back into your main Pulumi Challenge directory. Create a new file called `swag.json`, and add the following (replacing the values with your own information):
```json
{
"pulumi-challenge-swag": {
"name": "<yourname>",
"email": "<youremail>",
"address": "<youraddress>",
"size": "<oneofXS,S,M,L,XL>"
}
}
```
We also have new dependencies to add to `requirements.txt` at the root of your repo. It should now look like this:
Congratulations!. You've completed this Pulumi Challenge. If you'd like to tear down all of these resources, run `pulumi destroy -y`. Otherwise, have fun playing around with your new serverless application! Add whatever you like, or try one of the many other [Pulumi Architecture Templates](/templates/). Your swag will be in the mail shortly! Note that you'll only get one piece no matter how many times you submit. :)
Wanna yell it from the rooftops? Write a blog or post a quick video about it, send us the URL, and we'll send you a super secret piece of swag! Tag us on social media or email us at [da@pulumi.com](mailto:da@pulumi.com).