Skip to content

Commit

Permalink
Remove mappings to aws classic resources
Browse files Browse the repository at this point in the history
This PR removes the manual mappings to aws classic resources that now
exist in aws-native.

BREAKING CHANGE: resources that were previously deployed with the `aws`
provider are now deployed with the `aws-native` provider. This will
cause resource replacement

re #142
  • Loading branch information
corymhall committed Sep 6, 2024
1 parent 1a30538 commit 3c75969
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 617 deletions.
60 changes: 0 additions & 60 deletions examples/cron-lambda/adapter.ts

This file was deleted.

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
35 changes: 0 additions & 35 deletions examples/fargate/adapter.ts

This file was deleted.

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

0 comments on commit 3c75969

Please sign in to comment.