Pulumi AWS Provider
repository·master·Indexed 20 days ago
https://github.com/pulumi/pulumi-awsThe Pulumi AWS provider allows developers to manage Amazon Web Services resources using Infrastructure as Code (IaC) in languages including TypeScript, Python, Go, and .NET. It provides capabilities to automate the provisioning of services such as S3 buckets, EC2 instances, Lambda functions, ECR, and EKS. The provider supports multi-region deployment and offers specialized features like aws.lambda.CallbackFunction for defining Lambda functions directly in JavaScript or TypeScript.
What's inside pulumi-aws
- The Pulumi AWS provider is a package designed for creating and managing Amazon Web Services (AWS) cloud resources using Pulumi's Infrastructure as Code (IaC) capabilities. It allows developers to define AWS infrastructure using familiar programming languages like TypeScript, Python, Go, Java, and .NET.
Use the Pulumi AWS provider to manage AWS resources
masterThepulumi-awspackage is the official Pulumi provider for Amazon Web Services (AWS). It allows you to define, deploy, and manage AWS cloud resources using familiar programming languages like TypeScript, Python, Go, Java, and .NET. By using this provider, you can automate the provisioning of services such as S3 buckets, EC2 instances, Lambda functions, and more through Pulumi's Infrastructure as Code (IaC) engine.Use the Pulumi AWS provider for .NET
masterThePulumi.Awspackage allows you to create and manage Amazon Web Services (AWS) cloud resources using C# and the .NET ecosystem. This package provides strongly-typed classes for AWS services such as Athena, EC2, S3, and more, enabling infrastructure-as-code workflows within .NET applications.Use the Pulumi AWS provider
masterThe Pulumi AWS provider is a package designed for creating and managing Amazon Web Services (AWS) cloud resources using Pulumi's Infrastructure as Code (IaC) engine. It allows you to define AWS infrastructure using familiar programming languages like TypeScript, Python, Go, Java, and .NET.What is a CallbackFunction and how does it work?
masterA
aws.lambda.CallbackFunctionis a specialized version ofaws.lambda.Functionthat allows you to define your Lambda handler using an actual JavaScript/TypeScript function instance.When you use a
CallbackFunction, the Pulumi compiler and runtime automatically:- Extract your function.
- Package it along with its dependencies.
- Upload the package to AWS Lambda.
- Configure the resulting AWS Lambda resources.
The function can capture references to variables in the surrounding code, including other Pulumi resources or imported modules. Pulumi handles the serialization of these closures during the upload process.
Go SDK type generation changes
masterVersion 4.13.0 introduced a breaking change in how types are generated for the Pulumi Go SDK. While these changes generally relax allowed types for input properties onStatetypes, some properties may require updates to match the new desired types in this and future releases.Managing state migrations in patches
masterCarrying state migrations in a patch carries significant risk because Pulumi's bridge behavior might not persist migrations as expected. For example, during a no-refresh
pulumi up, the bridge might run an upgrader during diff computation, but if no diff is detected, the upgraded state may not be written to disk, leading to old state being used during later deletions.Before carrying a state migration, you must:
- Confirm the migration is required instead of making provider operations compatible with existing state.
- Compare the schema version and migration with the upstream pull request.
- Explain how future upstream replacements will consume state written by this patch.
- Add a Pulumi provider-upgrade test that covers:
- Creating state with a released provider.
- No-refresh updates.
- Refresh operations.
- Direct deletions.
- Preserve identifiers needed by later operations unless live lifecycle evidence proves a migration is necessary.
How Provider role chaining works in v7
masterVersion 7 introduces support for IAM role chaining by changing the
assumeRoleproperty to a list that accepts multiple arguments. This is now represented by theassumeRolesproperty.If you are providing the
assumeRoleproperty on theProvideror using theaws:assumeRoleconfiguration, you must update your code to use the new list-based format.Provider Configuration Change:
v6 (Old):
const provider = new aws.Provider("provider", { assumeRole: {roleArn: baseRole.arn}, });v7 (New):
const provider = new aws.Provider("provider", { assumeRoles: [{roleArn: baseRole.arn}], });Pulumi Config Change:
v6 (Old):
config: aws:assumeRole: roleArn: arn:aws:iam::12345678912/someRolev7 (New):
config: aws:assumeRoles: - roleArn: arn:aws:iam::12345678912/someRoleimport * as aws from '@pulumi/aws'; const provider = new aws.Provider("provider", { assumeRoles: [{roleArn: baseRole.arn}], });How `aws.lambda.CallbackFunction` works
masterTheaws.lambda.CallbackFunctionclass allows you to define an AWS Lambda function directly using a JavaScript or TypeScript function object. Pulumi handles the transformation of your code into a valid AWS Lambda resource automatically. This is particularly useful for creating event-driven functions, such as those triggered by S3 bucket manipulations or CloudWatch timers, without manually managing the underlying deployment artifacts.Go SDK Kinesis type renaming
masterIn version 3.27.0, a breaking change was made to resolve name collisions in the Go SDK. The typekinesis.AnalyticsApplicationOutputand its variants (*Args,*Output,*ArrayOutputetc.) were renamed tokinesis.AnalyticsApplicationOutputType<Variant>. Existing Go programs using the old names must be updated to use the new naming convention. This change does not result in resource recreation.Identify non-region-aware AWS resources
masterNot all AWS resources in the Pulumi AWS provider support the
regionproperty. Resources fall into one of three categories:- Global Services: These exist across all Regions within a partition and do not use a specific region (e.g., IAM, CloudFront, Route 53, Organizations).
- Global Resources in Regional Services: Some services are regional, but contain specific resources that are global (e.g.,
aws.s3.AccountPublicAccessBlockoraws.directconnect.Gateway). - Meta Data Sources: Functions like
aws.getPartitionandaws.getRegionsare effectively global.
If you attempt to use the
regionproperty on a resource that is not region-aware, it will not behave as expected or may be ignored.Use iam.PolicyDocument for AWS resource policies
masterStarting from version
0.18.15, several resources allow you to pass aniam.PolicyDocumentdirectly to their policy fields instead of raw JSON strings. Supported resources include:aws.s3.Bucket(via thewebsitefield forroutingRules)aws.iam.Policy(via thepolicyfield)aws.s3.Bucket(via thepolicyfield)aws.ecr.Repository(via thepolicyfield)elastic_search_*access policies
Additionally, version
0.18.10enabled passingPolicyDocumenttoaws.iam.Policyandaws.s3.Bucket.