Cloud Framework
The Cloud Framework for Pulumi lets you program infrastructure and application logic, side by side, using simple, high-level, cloud-agnostic building blocks.
The Cloud Framework must be configured with credentials to deploy and update resources in the target cloud platform.
See the full API documentation for complete details of the available Cloud Framework APIs.
For AWS-specific use cases, see also the awsx library which provides higher-level libraries for working with many AWS services.
Getting Started
The easiest way to start with the Cloud Framework is to follow one of the tutorials:
- A simple serverless REST API: Deploy cloud-agnostic managed REST API
- A simple containerized app: Deploy cloud-agnostic containerized services
- Serverless + Containers + Infrastructure: Deploy a complete cloud-agnostic application using a combination of buckets, serverless functions and containers.
In addition to the tutorials, several interesting examples are available with instructions:
- HTTP API
- Containers
- Thumbnailer (buckets, containers, functions)
- URL Shortener (table, API)
- Voting App (table, API)
Example
const cloud = require("@pulumi/cloud");
const api = new cloud.API("my-api");
api.get("/hello", (req, res) => {
res.json({ message: "Hi, world!" });
});
exports.url = api.publish().url;
Libraries
The following packages are available in package managers:
- JavaScript/TypeScript: https://www.npmjs.com/package/@pulumi/cloud
The provider-specific implementations of this library are also available for use directly when writing code that does not need to be portable:
- JavaScript/TypeScript: https://www.npmjs.com/package/@pulumi/cloud-aws
The Cloud Framework is open source and available in the pulumi/pulumi-cloud repo.
Authentication
Authentication options must be set for the target cloud provider. See the AWS setup page for details (more providers for the Cloud Framework coming soon).
Configuration
The Cloud Framework accepts the following configuration settings. These can be provided via pulumi config set cloud:<option>
.
provider
: (Required) The provider to deploy cloud resources into. Currently onlyaws
is supported.
The AWS implementation of the Cloud Framework accepts the following configuration settings. These can be provided via pulumi config set cloud-aws:<option>
.
functionMemorySize
: (Optional) Override the Lambda function memory size for all functions.functionIncludePaths
: (Optional) Comma-separated list of additional paths (relative to the project root) to include in Lambda zip uploads for JavaScript callbacks. E.g./img.png,app/
.functionIncludePackages
: (Optional) Comma-separated list of additional packages (relative to the project root) to include in Lambda zip uploads for JavaScript callbacks. E.gbody-parser,typescript
.computeIAMRolePolicyARNs
: (Optional) Set the IAM role policies to apply to compute (both Lambda and ECS) within this Pulumi program. The default is:arn:aws:iam::aws:policy/AWSLambda_FullAccess,arn:aws:iam::aws:policy/AmazonECS_FullAccess
.acmCertificateARN
: (Optional) ACM certificate ARN to support services HTTPS traffic.ecsClusterARN
: (Optional) ECS cluster ARN. One ofuseFargate
,ecsClusterARN
, orecsAutoCluster
must be provided to use container-based resources likecloud.Service
andcloud.Task
.ecsClusterSecurityGroup
: (Optional) ECS cluster security group that all ALBs for services within the cluster will use.ecsClusterEfsMountPath
: (Optional) EFS mount path on the cluster hosts. If not provided,Volumes
cannot be used incloud.Service
andcloud.Task
.usePrivateNetwork
: (Optional) Put all compute in a private network.externalVpcId
: (Optional) Use an existing VPC. If bothusePrivateNetwork
andexternalVpcId
are provided, the VPC must be configured to run all compute in private subnets with Internet egress enabled via NAT Gateways.externalSubnets
: (Optional) Provide subnets ids for the VPC as a comma-separated string. Required if using an existing VPC.externalPublicSubnets
: (Optional) Provide public subnets ids for the VPC as a comma-separated string. Required if using an existing VPC.externalSecurityGroups
: (Optional) Provide securityGroup ids for the VPC as a comma-separated string. Required if using an existing VPC.useFargate
: (Optional) Wse Fargate-based container compute. All tasks must be Fargate-compatible. One ofuseFargate
,ecsClusterARN
, orecsAutoCluster
must be provided to use container-based resources likecloud.Service
and `cloud.Task.ecsAutoCluster
: (Optional) Auto-provision an ECS Cluster. If set to true, parameters for the cluster can be provided via the other “ecsAutoCluster*” configuration variables. One ofuseFargate
,ecsClusterARN
, orecsAutoCluster
must be provided to use container-based resources likecloud.Service
and `cloud.Task.ecsAutoClusterNumberOfAZs
: (Optional) The number of AZs to create subnets in as part of the cluster. Defaults to2
.ecsAutoClusterInstanceType
: (Optional) The EC2 instance type to use for the cluster. Defaults tot2.micro
.ecsAutoClusterInstanceRolePolicyARNs
: (Optional) The EC2 instance role policy ARN to use for the cluster. Defaults toarn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role,arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess
.ecsAutoClusterInstanceRootVolumeSize
: (Optional) The size (in GiB) of the EBS volume to attach to each instance as the root volume. Defaults to8
GiB.ecsAutoClusterInstanceDockerImageVolumeSize
: (Optional) The size (in GiB) of the EBS volume to attach to each instance as Docker Image volume. Defaults to50
GiB.ecsAutoClusterInstanceSwapVolumeSize
: (Optional) The size (in GiB) of the EBS volume to attach to each instance as the swap volume. Defaults to5
GiB.ecsAutoClusterMinSize
: (Optional) The minimum size of the cluster. Defaults to2
.ecsAutoClusterMaxSize
: (Optional) The maximum size of the cluster. Defaults to100
.ecsAutoClusterPublicKey
: (Optional) Public key material for SSH access to the cluster. See allowed formats. If not provided, no SSH access is enabled on VMs.ecsAutoClusterECSOptimizedAMIName
: (Optional) The name of the ECS-optimzed AMI to use for the Container Instances in this cluster, e.g.amzn-ami-2017.09.l-amazon-ecs-optimized
. See valid values.ecsAutoClusterUseEFS
: (Optional) Optionally auto-provision an Elastic File System for the Cluster. Defaults tofalse
.
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.