Skip to content

Instantly share code, notes, and snippets.

@Packet-Lost
Last active August 27, 2021 06:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Packet-Lost/9a698924573e88be3d79a59b1e83b401 to your computer and use it in GitHub Desktop.
Save Packet-Lost/9a698924573e88be3d79a59b1e83b401 to your computer and use it in GitHub Desktop.
ECS / Fargate Container Override with PowerShell
$envkeypair = New-Object Amazon.ECS.Model.KeyValuePair
$envkeypair.Name = "ENVIRONMENT_KEY"
$envkeypair.Value = "ENVIRONMENT_VALUE"
$containeroverride = New-Object Amazon.ECS.Model.ContainerOverride
$containeroverride.Name = "CONTAINER_NAME"
$containeroverride.Environment.Add($envkeypair)
New-ECSTask -Cluster "ECS_Cluster" -Overrides_ContainerOverride $containeroverride -Count 1 -LaunchType "FARGATE" -AwsvpcConfiguration_SecurityGroup "sg-123456ab" -AwsvpcConfiguration_Subnet "subnet-123456ab","subnet-123456cd" -TaskDefinition "task_definition_name" -StartedBy "PowerShell"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment