1. Packages
  2. AWS Classic
  3. API Docs
  4. apigateway
  5. Account

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

aws.apigateway.Account

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

    Provides a settings of an API Gateway Account. Settings is applied region-wide per provider block.

    Note: As there is no API method for deleting account settings or resetting it to defaults, destroying this resource will keep your account settings intact

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const assumeRole = aws.iam.getPolicyDocument({
        statements: [{
            effect: "Allow",
            principals: [{
                type: "Service",
                identifiers: ["apigateway.amazonaws.com"],
            }],
            actions: ["sts:AssumeRole"],
        }],
    });
    const cloudwatchRole = new aws.iam.Role("cloudwatch", {
        name: "api_gateway_cloudwatch_global",
        assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
    });
    const demo = new aws.apigateway.Account("demo", {cloudwatchRoleArn: cloudwatchRole.arn});
    const cloudwatch = aws.iam.getPolicyDocument({
        statements: [{
            effect: "Allow",
            actions: [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:DescribeLogGroups",
                "logs:DescribeLogStreams",
                "logs:PutLogEvents",
                "logs:GetLogEvents",
                "logs:FilterLogEvents",
            ],
            resources: ["*"],
        }],
    });
    const cloudwatchRolePolicy = new aws.iam.RolePolicy("cloudwatch", {
        name: "default",
        role: cloudwatchRole.id,
        policy: cloudwatch.then(cloudwatch => cloudwatch.json),
    });
    
    import pulumi
    import pulumi_aws as aws
    
    assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        effect="Allow",
        principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
            type="Service",
            identifiers=["apigateway.amazonaws.com"],
        )],
        actions=["sts:AssumeRole"],
    )])
    cloudwatch_role = aws.iam.Role("cloudwatch",
        name="api_gateway_cloudwatch_global",
        assume_role_policy=assume_role.json)
    demo = aws.apigateway.Account("demo", cloudwatch_role_arn=cloudwatch_role.arn)
    cloudwatch = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        effect="Allow",
        actions=[
            "logs:CreateLogGroup",
            "logs:CreateLogStream",
            "logs:DescribeLogGroups",
            "logs:DescribeLogStreams",
            "logs:PutLogEvents",
            "logs:GetLogEvents",
            "logs:FilterLogEvents",
        ],
        resources=["*"],
    )])
    cloudwatch_role_policy = aws.iam.RolePolicy("cloudwatch",
        name="default",
        role=cloudwatch_role.id,
        policy=cloudwatch.json)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"apigateway.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"sts:AssumeRole",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		cloudwatchRole, err := iam.NewRole(ctx, "cloudwatch", &iam.RoleArgs{
    			Name:             pulumi.String("api_gateway_cloudwatch_global"),
    			AssumeRolePolicy: pulumi.String(assumeRole.Json),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigateway.NewAccount(ctx, "demo", &apigateway.AccountArgs{
    			CloudwatchRoleArn: cloudwatchRole.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		cloudwatch, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Effect: pulumi.StringRef("Allow"),
    					Actions: []string{
    						"logs:CreateLogGroup",
    						"logs:CreateLogStream",
    						"logs:DescribeLogGroups",
    						"logs:DescribeLogStreams",
    						"logs:PutLogEvents",
    						"logs:GetLogEvents",
    						"logs:FilterLogEvents",
    					},
    					Resources: []string{
    						"*",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewRolePolicy(ctx, "cloudwatch", &iam.RolePolicyArgs{
    			Name:   pulumi.String("default"),
    			Role:   cloudwatchRole.ID(),
    			Policy: pulumi.String(cloudwatch.Json),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "apigateway.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "sts:AssumeRole",
                    },
                },
            },
        });
    
        var cloudwatchRole = new Aws.Iam.Role("cloudwatch", new()
        {
            Name = "api_gateway_cloudwatch_global",
            AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var demo = new Aws.ApiGateway.Account("demo", new()
        {
            CloudwatchRoleArn = cloudwatchRole.Arn,
        });
    
        var cloudwatch = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Effect = "Allow",
                    Actions = new[]
                    {
                        "logs:CreateLogGroup",
                        "logs:CreateLogStream",
                        "logs:DescribeLogGroups",
                        "logs:DescribeLogStreams",
                        "logs:PutLogEvents",
                        "logs:GetLogEvents",
                        "logs:FilterLogEvents",
                    },
                    Resources = new[]
                    {
                        "*",
                    },
                },
            },
        });
    
        var cloudwatchRolePolicy = new Aws.Iam.RolePolicy("cloudwatch", new()
        {
            Name = "default",
            Role = cloudwatchRole.Id,
            Policy = cloudwatch.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.iam.Role;
    import com.pulumi.aws.iam.RoleArgs;
    import com.pulumi.aws.apigateway.Account;
    import com.pulumi.aws.apigateway.AccountArgs;
    import com.pulumi.aws.iam.RolePolicy;
    import com.pulumi.aws.iam.RolePolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("apigateway.amazonaws.com")
                        .build())
                    .actions("sts:AssumeRole")
                    .build())
                .build());
    
            var cloudwatchRole = new Role("cloudwatchRole", RoleArgs.builder()
                .name("api_gateway_cloudwatch_global")
                .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
            var demo = new Account("demo", AccountArgs.builder()
                .cloudwatchRoleArn(cloudwatchRole.arn())
                .build());
    
            final var cloudwatch = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .effect("Allow")
                    .actions(                
                        "logs:CreateLogGroup",
                        "logs:CreateLogStream",
                        "logs:DescribeLogGroups",
                        "logs:DescribeLogStreams",
                        "logs:PutLogEvents",
                        "logs:GetLogEvents",
                        "logs:FilterLogEvents")
                    .resources("*")
                    .build())
                .build());
    
            var cloudwatchRolePolicy = new RolePolicy("cloudwatchRolePolicy", RolePolicyArgs.builder()
                .name("default")
                .role(cloudwatchRole.id())
                .policy(cloudwatch.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
        }
    }
    
    resources:
      demo:
        type: aws:apigateway:Account
        properties:
          cloudwatchRoleArn: ${cloudwatchRole.arn}
      cloudwatchRole:
        type: aws:iam:Role
        name: cloudwatch
        properties:
          name: api_gateway_cloudwatch_global
          assumeRolePolicy: ${assumeRole.json}
      cloudwatchRolePolicy:
        type: aws:iam:RolePolicy
        name: cloudwatch
        properties:
          name: default
          role: ${cloudwatchRole.id}
          policy: ${cloudwatch.json}
    variables:
      assumeRole:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - apigateway.amazonaws.com
                actions:
                  - sts:AssumeRole
      cloudwatch:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - effect: Allow
                actions:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:DescribeLogGroups
                  - logs:DescribeLogStreams
                  - logs:PutLogEvents
                  - logs:GetLogEvents
                  - logs:FilterLogEvents
                resources:
                  - '*'
    

    Create Account Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Account(name: string, args?: AccountArgs, opts?: CustomResourceOptions);
    @overload
    def Account(resource_name: str,
                args: Optional[AccountArgs] = None,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Account(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                cloudwatch_role_arn: Optional[str] = None)
    func NewAccount(ctx *Context, name string, args *AccountArgs, opts ...ResourceOption) (*Account, error)
    public Account(string name, AccountArgs? args = null, CustomResourceOptions? opts = null)
    public Account(String name, AccountArgs args)
    public Account(String name, AccountArgs args, CustomResourceOptions options)
    
    type: aws:apigateway:Account
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccountArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var accountResource = new Aws.ApiGateway.Account("accountResource", new()
    {
        CloudwatchRoleArn = "string",
    });
    
    example, err := apigateway.NewAccount(ctx, "accountResource", &apigateway.AccountArgs{
    	CloudwatchRoleArn: pulumi.String("string"),
    })
    
    var accountResource = new Account("accountResource", AccountArgs.builder()
        .cloudwatchRoleArn("string")
        .build());
    
    account_resource = aws.apigateway.Account("accountResource", cloudwatch_role_arn="string")
    
    const accountResource = new aws.apigateway.Account("accountResource", {cloudwatchRoleArn: "string"});
    
    type: aws:apigateway:Account
    properties:
        cloudwatchRoleArn: string
    

    Account Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Account resource accepts the following input properties:

    CloudwatchRoleArn string
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    CloudwatchRoleArn string
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    cloudwatchRoleArn String
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    cloudwatchRoleArn string
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    cloudwatch_role_arn str
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    cloudwatchRoleArn String
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Account resource produces the following output properties:

    ApiKeyVersion string
    The version of the API keys used for the account.
    Features List<string>
    A list of features supported for the account.
    Id string
    The provider-assigned unique ID for this managed resource.
    ThrottleSettings List<AccountThrottleSetting>
    Account-Level throttle settings. See exported fields below.
    ApiKeyVersion string
    The version of the API keys used for the account.
    Features []string
    A list of features supported for the account.
    Id string
    The provider-assigned unique ID for this managed resource.
    ThrottleSettings []AccountThrottleSetting
    Account-Level throttle settings. See exported fields below.
    apiKeyVersion String
    The version of the API keys used for the account.
    features List<String>
    A list of features supported for the account.
    id String
    The provider-assigned unique ID for this managed resource.
    throttleSettings List<AccountThrottleSetting>
    Account-Level throttle settings. See exported fields below.
    apiKeyVersion string
    The version of the API keys used for the account.
    features string[]
    A list of features supported for the account.
    id string
    The provider-assigned unique ID for this managed resource.
    throttleSettings AccountThrottleSetting[]
    Account-Level throttle settings. See exported fields below.
    api_key_version str
    The version of the API keys used for the account.
    features Sequence[str]
    A list of features supported for the account.
    id str
    The provider-assigned unique ID for this managed resource.
    throttle_settings Sequence[AccountThrottleSetting]
    Account-Level throttle settings. See exported fields below.
    apiKeyVersion String
    The version of the API keys used for the account.
    features List<String>
    A list of features supported for the account.
    id String
    The provider-assigned unique ID for this managed resource.
    throttleSettings List<Property Map>
    Account-Level throttle settings. See exported fields below.

    Look up Existing Account Resource

    Get an existing Account resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AccountState, opts?: CustomResourceOptions): Account
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_key_version: Optional[str] = None,
            cloudwatch_role_arn: Optional[str] = None,
            features: Optional[Sequence[str]] = None,
            throttle_settings: Optional[Sequence[AccountThrottleSettingArgs]] = None) -> Account
    func GetAccount(ctx *Context, name string, id IDInput, state *AccountState, opts ...ResourceOption) (*Account, error)
    public static Account Get(string name, Input<string> id, AccountState? state, CustomResourceOptions? opts = null)
    public static Account get(String name, Output<String> id, AccountState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApiKeyVersion string
    The version of the API keys used for the account.
    CloudwatchRoleArn string
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    Features List<string>
    A list of features supported for the account.
    ThrottleSettings List<AccountThrottleSetting>
    Account-Level throttle settings. See exported fields below.
    ApiKeyVersion string
    The version of the API keys used for the account.
    CloudwatchRoleArn string
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    Features []string
    A list of features supported for the account.
    ThrottleSettings []AccountThrottleSettingArgs
    Account-Level throttle settings. See exported fields below.
    apiKeyVersion String
    The version of the API keys used for the account.
    cloudwatchRoleArn String
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    features List<String>
    A list of features supported for the account.
    throttleSettings List<AccountThrottleSetting>
    Account-Level throttle settings. See exported fields below.
    apiKeyVersion string
    The version of the API keys used for the account.
    cloudwatchRoleArn string
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    features string[]
    A list of features supported for the account.
    throttleSettings AccountThrottleSetting[]
    Account-Level throttle settings. See exported fields below.
    api_key_version str
    The version of the API keys used for the account.
    cloudwatch_role_arn str
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    features Sequence[str]
    A list of features supported for the account.
    throttle_settings Sequence[AccountThrottleSettingArgs]
    Account-Level throttle settings. See exported fields below.
    apiKeyVersion String
    The version of the API keys used for the account.
    cloudwatchRoleArn String
    ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more in AWS Docs. Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
    features List<String>
    A list of features supported for the account.
    throttleSettings List<Property Map>
    Account-Level throttle settings. See exported fields below.

    Supporting Types

    AccountThrottleSetting, AccountThrottleSettingArgs

    BurstLimit int
    Absolute maximum number of times API Gateway allows the API to be called per second (RPS).
    RateLimit double
    Number of times API Gateway allows the API to be called per second on average (RPS).
    BurstLimit int
    Absolute maximum number of times API Gateway allows the API to be called per second (RPS).
    RateLimit float64
    Number of times API Gateway allows the API to be called per second on average (RPS).
    burstLimit Integer
    Absolute maximum number of times API Gateway allows the API to be called per second (RPS).
    rateLimit Double
    Number of times API Gateway allows the API to be called per second on average (RPS).
    burstLimit number
    Absolute maximum number of times API Gateway allows the API to be called per second (RPS).
    rateLimit number
    Number of times API Gateway allows the API to be called per second on average (RPS).
    burst_limit int
    Absolute maximum number of times API Gateway allows the API to be called per second (RPS).
    rate_limit float
    Number of times API Gateway allows the API to be called per second on average (RPS).
    burstLimit Number
    Absolute maximum number of times API Gateway allows the API to be called per second (RPS).
    rateLimit Number
    Number of times API Gateway allows the API to be called per second on average (RPS).

    Import

    Using pulumi import, import API Gateway Accounts using the word api-gateway-account. For example:

    $ pulumi import aws:apigateway/account:Account demo api-gateway-account
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi