Pulumi AWS Provider

repository·master·Indexed 20 days ago

https://github.com/pulumi/pulumi-aws

The 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.

Tokens
133.9K
Snippets
399
Records
912
Agent score
69%

What's inside pulumi-aws

  1. Overview of the Pulumi AWS Provider

    master
    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.
  2. Use the Pulumi AWS provider to manage AWS resources

    master
    The pulumi-aws package 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.
  3. Use the Pulumi AWS provider for .NET

    master
    The Pulumi.Aws package 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.
  4. What is a CallbackFunction and how does it work?

    master

    A aws.lambda.CallbackFunction is a specialized version of aws.lambda.Function that 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:

    1. Extract your function.
    2. Package it along with its dependencies.
    3. Upload the package to AWS Lambda.
    4. 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.

  5. Go SDK type generation changes

    master
    Version 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 on State types, some properties may require updates to match the new desired types in this and future releases.
  6. Managing state migrations in patches

    master

    Carrying 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.
  7. How Provider role chaining works in v7

    master

    Version 7 introduces support for IAM role chaining by changing the assumeRole property to a list that accepts multiple arguments. This is now represented by the assumeRoles property.

    If you are providing the assumeRole property on the Provider or using the aws:assumeRole configuration, 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/someRole

    v7 (New):

    config:
      aws:assumeRoles:
        - roleArn: arn:aws:iam::12345678912/someRole
    import * as aws from '@pulumi/aws';
    
    const provider = new aws.Provider("provider", {
        assumeRoles: [{roleArn: baseRole.arn}],
    });
  8. How `aws.lambda.CallbackFunction` works

    master
    The aws.lambda.CallbackFunction class 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.
  9. Go SDK Kinesis type renaming

    master
    In version 3.27.0, a breaking change was made to resolve name collisions in the Go SDK. The type kinesis.AnalyticsApplicationOutput and its variants (*Args, *Output, *ArrayOutput etc.) were renamed to kinesis.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.
  10. Identify non-region-aware AWS resources

    master

    Not all AWS resources in the Pulumi AWS provider support the region property. Resources fall into one of three categories:

    1. Global Services: These exist across all Regions within a partition and do not use a specific region (e.g., IAM, CloudFront, Route 53, Organizations).
    2. Global Resources in Regional Services: Some services are regional, but contain specific resources that are global (e.g., aws.s3.AccountPublicAccessBlock or aws.directconnect.Gateway).
    3. Meta Data Sources: Functions like aws.getPartition and aws.getRegions are effectively global.

    If you attempt to use the region property on a resource that is not region-aware, it will not behave as expected or may be ignored.

  11. Use iam.PolicyDocument for AWS resource policies

    master

    Starting from version 0.18.15, several resources allow you to pass an iam.PolicyDocument directly to their policy fields instead of raw JSON strings. Supported resources include:

    • aws.s3.Bucket (via the website field for routingRules)
    • aws.iam.Policy (via the policy field)
    • aws.s3.Bucket (via the policy field)
    • aws.ecr.Repository (via the policy field)
    • elastic_search_* access policies

    Additionally, version 0.18.10 enabled passing PolicyDocument to aws.iam.Policy and aws.s3.Bucket.