aws / aws/aws-cdk

cdk should create service linked roles

Open
#4,108 16 comments 27 reactions 1 assignee Claimed by @QuantumNeuralCoder View on GitHub
@aws-cdk/aws-applicationautoscaling @aws-cdk/aws-ecs feature-request needs-cfn p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

## :bug: Bug Report

### What is the problem?

I’m having an issue with setting up `AWS::ApplicationAutoScaling::ScalableTarget` for fargate service. Apparently cdk doesn’t create service-linked roles. I found similar issue (diff service) but it was closed #3734. Are we expected to pre-create these roles? I think the expected behavior should be for cdk to create the service-linked roles.

### Reproduction Steps

```typescript
const fargateService = new ecs.FargateService(this, "fargateService", {
cluster,
taskDefinition: taskDef,
desiredCount: 1,
propagateTaskTagsFrom: ecs.PropagatedTagSource.SERVICE
});

const scaling = tnmaccessService.autoScaleTaskCount({
minCapacity: 0,
maxCapacity: 1
});

scaling.scaleOnSchedule("scalingUp", {
schedule: Schedule.expression("cron(0 15 ? * MON-FRI *)"), // MON-FRI @ 9am MT
minCapacity: 1,
maxCapacity: 1
});

scaling.scaleOnSchedule("scalingDown", {
schedule: Schedule.expression("cron(0 22 ? * MON-FRI *)"), // MON-FRI @ 4pm MT
minCapacity: 0,
maxCapacity: 0
});
```

### Verbose Log

```bash
3/4 | 11:46:15 AM | CREATE_FAILED | AWS::ApplicationAutoScaling::ScalableTarget | fargateService/TaskCount/Target (fargateServiceTaskCountTarget655BF465)
Unable to assume IAM role: arn:aws:iam::1234567890:role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService
(Service: AWSApplicationAutoScaling; Status Code: 400; Error Code: ValidationException; Request ID: e0fa3fe9-d8a9-11e9-9457-e58085b5712e)
```

### Environment

- **CDK CLI Version:** 1.8.0 (build 5244f97)
- **OS:** OSX High Sierra
- **Language:** TypeScript

### Other information

https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-service-linked-roles.html

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.