This guide explains how to set up and bootstrap a Pulumi project using the pulumi new command for AWS and Python.
In this guide, we will walk through the process of setting up and bootstrapping a Pulumi project using the pulumi new command. Pulumi streamlines cloud infrastructure deployments by allowing you to choose your cloud provider and preferred programming language while automatically handling the necessary configurations.
Microsoft Windows [Version 10.0.19045.2965](c) Microsoft Corporation. All rights reserved.C:\Users\sanje\Documents\scratch\pulumi-demo> pulumi newPlease choose a template (10/215 shown):[Use arrows to move, type to filter]> aiven-go A minimal Aiven Go Pulumi program aiven-python A minimal Aiven Python Pulumi program aiven-typescript A minimal Aiven TypeScript Pulumi program alicloud-csharp A minimal AliCloud C# Pulumi program alicloud-fsharp A minimal AliCloud F# Pulumi program alicloud-go A minimal AliCloud Go Pulumi program alicloud-javascript A minimal AliCloud JavaScript Pulumi program alicloud-python A minimal AliCloud Python Pulumi program alicloud-typescript A minimal AliCloud TypeScript Pulumi program alicloud-visualbasic A minimal AliCloud VB.NET Pulumi program
Since this project is developed in Python for AWS, scroll down to the AWS section and select the template titled “A minimal AWS Python Pulumi program.” Once selected, you will be guided through the next steps.
After picking the AWS-Python template, the tool will prompt you for some basic project information.
Project Name & Description:
Accept the default values (for example, pulumi-demo for the project name and the corresponding description) unless you prefer to customize them.
Stack Name:
A stack represents an isolated instance of your project configuration, which is useful for managing different environments such as development, staging, and production. In this guide, we use the default dev stack for the development environment:
Copy
C:\Users\sanje\Documents\scratch\pulumi-demo> pulumi newPlease choose a template (10/215 shown): A minimal AWS Python Pulumi programThis 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: (pulumi-demo)project description: (A minimal AWS Python Pulumi program)Created project 'pulumi-demo'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)
AWS Region Selection:
You will be prompted to select the AWS region for deployment. In this example, we use us-east-1, but you may choose any region appropriate for your project.
Copy
Microsoft Windows [Version 10.0.19045.2965](c) Microsoft Corporation. All rights reserved.C:\Users\sanje\Documents\scratch\pulumi-demo> pulumi newPlease choose a template (10/215 shown): A minimal AWS Python Pulumi programThis command will walk you through creating a new Pulumi project.Enter a value or leave blank to accept the (default), and press <ENTER>.project name: (pulumi-demo)project description: (A minimal AWS Python Pulumi program)Created project 'pulumi-demo'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-east-1)Saved configInstalling dependencies...Creating virtual environment...
If you were setting up a project for another cloud provider (such as Azure), the process remains similar but Pulumi would install dependencies related to that specific provider (e.g., Pulumi-Azure).
All the boilerplate code for your Pulumi project is stored in the main.py file. Open this file in your favorite code editor to explore the default configuration and sample infrastructure code generated by Pulumi.
Now that your project is fully set up, you can begin modifying the code in main.py to define your infrastructure. When you’re ready, execute pulumi up to deploy your resources.
By following these steps, you have successfully bootstrapped your Pulumi project configured for AWS and Python. Enjoy building and deploying your cloud infrastructure!