Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mappings to aws classic resources #163

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/cron-lambda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import * as aws_lambda from 'aws-cdk-lib/aws-lambda';
import { Duration } from 'aws-cdk-lib';
import * as pulumi from '@pulumi/pulumi';
import * as pulumicdk from '@pulumi/cdk';
import { remapCloudControlResource } from './adapter';

class LambdaStack extends pulumicdk.Stack {
lambdaArn: pulumi.Output<string>;

constructor(id: string, options?: pulumicdk.StackOptions) {
super(id, { ...options, remapCloudControlResource });
super(id, options);

// Use the AWS CDK Lambda Function API directly.
const lambdaFn = new aws_lambda.Function(this, 'lambda', {
Expand Down
14 changes: 5 additions & 9 deletions examples/fargate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as ecs_patterns from 'aws-cdk-lib/aws-ecs-patterns';

import { remapCloudControlResource } from './adapter';

class FargateStack extends pulumicdk.Stack {

loadBalancerDNS: pulumi.Output<string>;

constructor(id: string, options?: pulumicdk.StackOptions) {
super(id, { ...options, remapCloudControlResource });
super(id, options);

// Create VPC and Fargate Cluster
// NOTE: Limit AZs to avoid reaching resource quotas
Expand All @@ -24,32 +21,31 @@ class FargateStack extends pulumicdk.Stack {
const fargateService = new ecs_patterns.NetworkLoadBalancedFargateService(this, 'sample-app', {
cluster,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample")
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
});

// Open port 80 inbound to IPs within VPC to allow network load balancer to connect to the service
fargateService.service.connections.securityGroups[0].addIngressRule(
ec2.Peer.ipv4(vpc.vpcCidrBlock),
ec2.Port.tcp(80),
"allow http inbound from vpc",
'allow http inbound from vpc',
);

// Setup AutoScaling policy
const scaling = fargateService.service.autoScaleTaskCount({ maxCapacity: 2 });
scaling.scaleOnCpuUtilization('CpuScaling', {
targetUtilizationPercent: 50,
scaleInCooldown: Duration.seconds(60),
scaleOutCooldown: Duration.seconds(60)
scaleOutCooldown: Duration.seconds(60),
});

this.loadBalancerDNS = this.asOutput(fargateService.loadBalancer.loadBalancerDnsName);

// Finalize the stack and deploy its resources.
this.synth();
}
};
}

const stack = new FargateStack('fargatestack');
export const loadBalancerURL = stack.loadBalancerDNS;

Loading
Loading